fix: Selection for code changes

This commit is contained in:
Petr Mironychev
2025-10-22 09:19:32 +02:00
parent 7e878cdbf8
commit 1122332423

View File

@ -86,15 +86,15 @@ FileEditItem {
Rectangle { Rectangle {
id: fileEditView id: fileEditView
anchors.fill: parent property bool expanded: false
anchors.fill: parent
implicitHeight: expanded ? headerArea.height + contentColumn.height + root.contentBottomPadding implicitHeight: expanded ? headerArea.height + contentColumn.height + root.contentBottomPadding
: headerArea.height : headerArea.height
radius: root.borderRadius radius: root.borderRadius
property bool expanded: false
color: palette.base color: palette.base
border.width: 1 border.width: 1
border.color: root.isPending border.color: root.isPending
? (color.hslLightness > 0.5 ? Qt.darker(color, 1.3) : Qt.lighter(color, 1.3)) ? (color.hslLightness > 0.5 ? Qt.darker(color, 1.3) : Qt.lighter(color, 1.3))
@ -224,16 +224,19 @@ FileEditItem {
spacing: 4 spacing: 4
visible: opacity > 0 visible: opacity > 0
// Context before (if available) TextEdit {
Text {
Layout.fillWidth: true Layout.fillWidth: true
visible: root.contextBefore.length > 0 visible: root.contextBefore.length > 0
text: root.contextBefore text: root.contextBefore
font.family: root.codeFontFamily font.family: root.codeFontFamily
font.pixelSize: root.codeFontSize font.pixelSize: root.codeFontSize
color: palette.mid color: palette.mid
wrapMode: Text.Wrap wrapMode: TextEdit.Wrap
opacity: 0.6 opacity: 0.6
readOnly: true
selectByMouse: true
selectByKeyboard: true
textFormat: TextEdit.PlainText
} }
Rectangle { Rectangle {
@ -245,7 +248,7 @@ FileEditItem {
border.color: Qt.rgba(1, 0.2, 0.2, 0.3) border.color: Qt.rgba(1, 0.2, 0.2, 0.3)
visible: root.originalContent.length > 0 visible: root.originalContent.length > 0
Text { TextEdit {
id: oldContentText id: oldContentText
anchors { anchors {
left: parent.left left: parent.left
@ -257,7 +260,11 @@ FileEditItem {
font.family: root.codeFontFamily font.family: root.codeFontFamily
font.pixelSize: root.codeFontSize font.pixelSize: root.codeFontSize
color: Qt.rgba(1, 0.2, 0.2, 0.9) color: Qt.rgba(1, 0.2, 0.2, 0.9)
wrapMode: Text.Wrap wrapMode: TextEdit.Wrap
readOnly: true
selectByMouse: true
selectByKeyboard: true
textFormat: TextEdit.PlainText
} }
} }
@ -269,7 +276,7 @@ FileEditItem {
border.width: 1 border.width: 1
border.color: Qt.rgba(0.2, 0.8, 0.2, 0.3) border.color: Qt.rgba(0.2, 0.8, 0.2, 0.3)
Text { TextEdit {
id: newContentText id: newContentText
anchors { anchors {
left: parent.left left: parent.left
@ -281,19 +288,27 @@ FileEditItem {
font.family: root.codeFontFamily font.family: root.codeFontFamily
font.pixelSize: root.codeFontSize font.pixelSize: root.codeFontSize
color: Qt.rgba(0.2, 0.8, 0.2, 0.9) color: Qt.rgba(0.2, 0.8, 0.2, 0.9)
wrapMode: Text.Wrap wrapMode: TextEdit.Wrap
readOnly: true
selectByMouse: true
selectByKeyboard: true
textFormat: TextEdit.PlainText
} }
} }
Text { TextEdit {
Layout.fillWidth: true Layout.fillWidth: true
visible: root.contextAfter.length > 0 visible: root.contextAfter.length > 0
text: root.contextAfter text: root.contextAfter
font.family: root.codeFontFamily font.family: root.codeFontFamily
font.pixelSize: root.codeFontSize font.pixelSize: root.codeFontSize
color: palette.mid color: palette.mid
wrapMode: Text.Wrap wrapMode: TextEdit.Wrap
opacity: 0.6 opacity: 0.6
readOnly: true
selectByMouse: true
selectByKeyboard: true
textFormat: TextEdit.PlainText
} }
Text { Text {