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