summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2016-08-04 15:21:47 +0200
committerAndy Shaw <andy.shaw@qt.io>2016-08-05 05:56:18 +0000
commit9b3a7ece479997fc093ae913255b37c937291795 (patch)
treee5c94710ad6053c4f893f8a1c83be2c7cb1e4346 /src
parentdbfd7f304c4d91096e104ec2383d92a37502d836 (diff)
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 <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextengine.cpp9
1 files changed, 5 insertions, 4 deletions
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;
}