From 9b3a7ece479997fc093ae913255b37c937291795 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 4 Aug 2016 15:21:47 +0200 Subject: Re-add the space character as a document terminator With change 208496091d994c2ffe44ea41368fb659978c1581 the space character was replaced with a visual document terminator character. However this meant that if the whitespace was visualized without the document terminator character visualized then clicking after the text would cause it to be positioned off by one. By bringing back the space character when the terminator is not being visualized then it will correctly place the cursor at the end of the text. Change-Id: I335c1773a37a654f3196bd350562e8f92ffd5369 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextengine.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 28fb9d2769..7378b129a9 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1569,12 +1569,13 @@ void QTextEngine::validate() const layoutData = new LayoutData(); if (block.docHandle()) { layoutData->string = block.text(); - if (block.next().isValid()) { - if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) - layoutData->string += QChar(0xb6); - } else if (option.flags() & QTextOption::ShowDocumentTerminator) { + const bool nextBlockValid = block.next().isValid(); + if (!nextBlockValid && option.flags() & QTextOption::ShowDocumentTerminator) { layoutData->string += QChar(0xA7); + } else if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) { + layoutData->string += QLatin1Char(nextBlockValid ? 0xb6 : 0x20); } + } else { layoutData->string = text; } -- cgit v1.2.3