From 85aaf7bcce88b644da7dcd0d5eb0f97bfc928d3d Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 1 Sep 2019 15:44:06 -0400 Subject: [PATCH] Don't copy combined invisible names --- TODO.md | 4 +--- src/qml/Base/HSelectableLabel.qml | 9 +++++++++ src/qml/Chat/Timeline/EventContent.qml | 1 + src/qml/Chat/Timeline/EventDelegate.qml | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index e9cd8806..4b4ed436 100644 --- a/TODO.md +++ b/TODO.md @@ -28,6 +28,7 @@ - Don't strip user spacing in html - Do something when access token is invalid + - Don't store states in delegates - Message position after daybreak delegate (fixed by commit 57b1313 ?) - [hr not working](https://bugreports.qt.io/browse/QTBUG-74342) - Terrible performance using `QT_QPA_PLATFORM=wayland-egl`, must use `xcb` @@ -40,9 +41,6 @@ - Room header descriptions: styled text - Message selection - - ctrl-c - - Copy appending copies? - - Don't copy combined message names - Copy link - Make scroll wheel usable - Copy to X11 selection diff --git a/src/qml/Base/HSelectableLabel.qml b/src/qml/Base/HSelectableLabel.qml index 38c61f65..f3c11502 100644 --- a/src/qml/Base/HSelectableLabel.qml +++ b/src/qml/Base/HSelectableLabel.qml @@ -23,9 +23,18 @@ TextEdit { // in container.joinedSelection. If it's a decimal number, if gets one \n. property real index property HSelectableLabelContainer container + property bool selectable: true function updateSelection() { + if (! selectable && label.selectedText) { + label.deselect() + updateContainerSelectedTexts() + return + } + + if (! selectable) return + if (! container.reversed && container.selectionStart <= container.selectionEnd || diff --git a/src/qml/Chat/Timeline/EventContent.qml b/src/qml/Chat/Timeline/EventContent.qml index e12d5670..a387e9d5 100644 --- a/src/qml/Chat/Timeline/EventContent.qml +++ b/src/qml/Chat/Timeline/EventContent.qml @@ -53,6 +53,7 @@ Row { width: parent.width visible: ! hideNameLine container: selectableLabelContainer + selectable: ! unselectableNameLine // This is +0.1 and content is +0 instead of the opposite, // because the eventList is reversed diff --git a/src/qml/Chat/Timeline/EventDelegate.qml b/src/qml/Chat/Timeline/EventDelegate.qml index 586ef233..b60b3b91 100644 --- a/src/qml/Chat/Timeline/EventDelegate.qml +++ b/src/qml/Chat/Timeline/EventDelegate.qml @@ -35,6 +35,9 @@ Column { onRight || combine + readonly property bool unselectableNameLine: + hideNameLine && ! (onRight && ! combine) + width: eventList.width topPadding: