diff options
-rw-r--r-- | components/kube/contents/ui/ComposerView.qml | 1 | ||||
-rw-r--r-- | framework/src/domain/documenthandler.cpp | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/components/kube/contents/ui/ComposerView.qml b/components/kube/contents/ui/ComposerView.qml index f82b4269..1571a746 100644 --- a/components/kube/contents/ui/ComposerView.qml +++ b/components/kube/contents/ui/ComposerView.qml | |||
@@ -360,6 +360,7 @@ Kube.View { | |||
360 | 360 | ||
361 | onActiveFocusChanged: closeFirstSplitIfNecessary() | 361 | onActiveFocusChanged: closeFirstSplitIfNecessary() |
362 | Keys.onEscapePressed: recipients.forceActiveFocus() | 362 | Keys.onEscapePressed: recipients.forceActiveFocus() |
363 | cursorPosition: document.cursorPosition | ||
363 | text: composerController.body | 364 | text: composerController.body |
364 | onTextChanged: composerController.body = text; | 365 | onTextChanged: composerController.body = text; |
365 | } | 366 | } |
diff --git a/framework/src/domain/documenthandler.cpp b/framework/src/domain/documenthandler.cpp index 03e5ad69..266f4a27 100644 --- a/framework/src/domain/documenthandler.cpp +++ b/framework/src/domain/documenthandler.cpp | |||
@@ -91,6 +91,21 @@ int DocumentHandler::cursorPosition() const | |||
91 | void DocumentHandler::setCursorPosition(int position) | 91 | void DocumentHandler::setCursorPosition(int position) |
92 | { | 92 | { |
93 | if (position != m_cursorPosition) { | 93 | if (position != m_cursorPosition) { |
94 | //Skip over invisible char | ||
95 | if (m_cursorPosition < position) { | ||
96 | auto cursor = textCursor(); | ||
97 | cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); | ||
98 | if (cursor.selectedText() == "\u2063") { | ||
99 | position++; | ||
100 | } | ||
101 | } | ||
102 | if (m_cursorPosition > position) { | ||
103 | auto cursor = textCursor(); | ||
104 | cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor); | ||
105 | if (cursor.selectedText() == "\u2063") { | ||
106 | position--; | ||
107 | } | ||
108 | } | ||
94 | m_cursorPosition = position; | 109 | m_cursorPosition = position; |
95 | reset(); | 110 | reset(); |
96 | emit cursorPositionChanged(); | 111 | emit cursorPositionChanged(); |