Re-add the space character as a document terminator

With change 208496091d 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>
This commit is contained in:
Andy Shaw 2016-08-04 15:21:47 +02:00
parent dbfd7f304c
commit 9b3a7ece47

View File

@ -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;
}