Fix ctrl-c behavior
This commit is contained in:
parent
922eac4ea9
commit
9936a7e2ee
|
@ -18,15 +18,6 @@ TextEdit {
|
|||
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
|
||||
Keys.onPressed: ev => {
|
||||
if (ev.matches(StandardKey.Copy)) {
|
||||
ev.accepted = true
|
||||
Utils.copyToClipboard(container.joinedSelection)
|
||||
return
|
||||
}
|
||||
ev.accepted = false
|
||||
}
|
||||
|
||||
|
||||
// If index is a whole number, the label will get two \n before itself
|
||||
// in container.joinedSelection. If it's a decimal number, if gets one \n.
|
||||
|
|
|
@ -2,7 +2,7 @@ import QtQuick 2.12
|
|||
import "../utils.js" as Utils
|
||||
|
||||
FocusScope {
|
||||
onFocusChanged: if (! focus) clearSelection()
|
||||
onSelectedTextsChanged: if (selectedTexts) composer.textArea.deselect()
|
||||
|
||||
|
||||
signal deselectAll()
|
||||
|
|
|
@ -13,6 +13,8 @@ HSplitView {
|
|||
Layout.fillWidth: true
|
||||
|
||||
EventList {
|
||||
id: eventList
|
||||
|
||||
// Avoid a certain binding loop
|
||||
Layout.minimumWidth: theme.minimumSupportedWidth
|
||||
Layout.fillWidth: true
|
||||
|
|
|
@ -140,13 +140,17 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
area.Keys.onReturnPressed.connect(event => {
|
||||
event.accepted = true
|
||||
area.onSelectedTextChanged: if (area.selectedText) {
|
||||
eventList.selectableLabelContainer.clearSelection()
|
||||
}
|
||||
|
||||
if (event.modifiers & Qt.ShiftModifier ||
|
||||
event.modifiers & Qt.ControlModifier ||
|
||||
event.modifiers & Qt.AltModifier)
|
||||
Component.onCompleted: {
|
||||
area.Keys.onReturnPressed.connect(ev => {
|
||||
ev.accepted = true
|
||||
|
||||
if (ev.modifiers & Qt.ShiftModifier ||
|
||||
ev.modifiers & Qt.ControlModifier ||
|
||||
ev.modifiers & Qt.AltModifier)
|
||||
{
|
||||
let indents = 0
|
||||
let parts = lineText.split(indent)
|
||||
|
@ -171,17 +175,27 @@ Rectangle {
|
|||
|
||||
area.Keys.onEnterPressed.connect(area.Keys.onReturnPressed)
|
||||
|
||||
area.Keys.onTabPressed.connect(event => {
|
||||
event.accepted = true
|
||||
area.Keys.onTabPressed.connect(ev => {
|
||||
ev.accepted = true
|
||||
textArea.insert(cursorPosition, indent)
|
||||
})
|
||||
|
||||
area.Keys.onPressed.connect(event => {
|
||||
if (event.modifiers == Qt.NoModifier &&
|
||||
event.key == Qt.Key_Backspace &&
|
||||
area.Keys.onPressed.connect(ev => {
|
||||
if (ev.matches(StandardKey.Copy) &&
|
||||
eventList.selectableLabelContainer.joinedSelection
|
||||
) {
|
||||
ev.accepted = true
|
||||
Utils.copyToClipboard(
|
||||
eventList.selectableLabelContainer.joinedSelection,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (ev.modifiers == Qt.NoModifier &&
|
||||
ev.key == Qt.Key_Backspace &&
|
||||
! textArea.selectedText)
|
||||
{
|
||||
event.accepted = true
|
||||
ev.accepted = true
|
||||
textArea.remove(
|
||||
cursorPosition - deleteCharsOnBackspace,
|
||||
cursorPosition
|
||||
|
|
|
@ -3,7 +3,8 @@ import "../../Base"
|
|||
import "../../utils.js" as Utils
|
||||
|
||||
Rectangle {
|
||||
property alias listView: eventList
|
||||
property alias selectableLabelContainer: selectableLabelContainer
|
||||
property alias eventList: eventList
|
||||
|
||||
color: theme.chat.eventList.background
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user