From c9843bb2ffa191f21a23c1643950a93362a47ea6 Mon Sep 17 00:00:00 2001 From: miruka Date: Sat, 11 Jul 2020 16:10:21 -0400 Subject: [PATCH] HTextArea: prevent leaking left/right if readOnly --- src/gui/Base/HTextArea.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/Base/HTextArea.qml b/src/gui/Base/HTextArea.qml index 9d294203..6a172e95 100644 --- a/src/gui/Base/HTextArea.qml +++ b/src/gui/Base/HTextArea.qml @@ -97,9 +97,11 @@ TextArea { // Prevent leaking arrow presses to parent elements when the carret is at // the beginning or end of the text - Keys.onLeftPressed: event.accepted = cursorPosition === 0 && ! selectedText + Keys.onLeftPressed: + event.accepted = readOnly || (cursorPosition === 0 && ! selectedText) Keys.onRightPressed: - event.accepted = cursorPosition === length && ! selectedText + event.accepted = + readOnly || (cursorPosition === length && ! selectedText) KeyNavigation.priority: KeyNavigation.BeforeItem KeyNavigation.tab: focusItemOnTab