diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-13 10:44:49 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-13 10:44:49 +0200 |
commit | e87ecb949e77211eb21e30a97a65426f87231414 (patch) | |
tree | 102df49b25b3558a21120954d8d40b53f0735d97 /framework/src/domain/documenthandler.cpp | |
parent | 4948d6d5cf64aaf7f1b344202dabc7ba92540e4f (diff) | |
download | kube-e87ecb949e77211eb21e30a97a65426f87231414.tar.gz kube-e87ecb949e77211eb21e30a97a65426f87231414.zip |
Skip over invisible char
Diffstat (limited to 'framework/src/domain/documenthandler.cpp')
-rw-r--r-- | framework/src/domain/documenthandler.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
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(); |