From e87ecb949e77211eb21e30a97a65426f87231414 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 13 Sep 2017 10:44:49 +0200 Subject: Skip over invisible char --- framework/src/domain/documenthandler.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'framework') 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 void DocumentHandler::setCursorPosition(int position) { if (position != m_cursorPosition) { + //Skip over invisible char + if (m_cursorPosition < position) { + auto cursor = textCursor(); + cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); + if (cursor.selectedText() == "\u2063") { + position++; + } + } + if (m_cursorPosition > position) { + auto cursor = textCursor(); + cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor); + if (cursor.selectedText() == "\u2063") { + position--; + } + } m_cursorPosition = position; reset(); emit cursorPositionChanged(); -- cgit v1.2.3