From d1493b972b29e92937516b08e72a2e66ac9f349e Mon Sep 17 00:00:00 2001 From: Safa AlFulaij Date: Thu, 25 Jan 2018 09:33:09 +0300 Subject: [PATCH] QTextDocumentFragment: Use logical cursor movement instead of visual Using QTextCursor::Left and QTextCursor::Right moves the cursor visually to right or left, which does not work with Right to left text, where moving left means advancing to the next character, and vice versa. By using QTextCursor::PreviousCharacter and QTextCursor::NextCharacter we leave it up to the engine for deciding where to move depending on the context. Task-number: QTBUG-50619 Change-Id: Ibf0a886f3ff6bf9ca2c953aeff8c235612bbc01d Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextdocumentfragment.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp index 3ad49b3f88..f0eff2d4f3 100644 --- a/src/gui/text/qtextdocumentfragment.cpp +++ b/src/gui/text/qtextdocumentfragment.cpp @@ -724,9 +724,9 @@ QTextHtmlImporter::ProcessNodeResult QTextHtmlImporter::processSpecialNodes() cursor.insertImage(fmt, QTextFrameFormat::Position(currentNode->cssFloat)); - cursor.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor); + cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor); cursor.mergeCharFormat(currentNode->charFormat); - cursor.movePosition(QTextCursor::Right); + cursor.movePosition(QTextCursor::NextCharacter); compressNextWhitespace = CollapseWhiteSpace; hasBlock = false;