summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextengine.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2016-05-31 10:56:25 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2016-06-01 10:04:02 +0000
commit8fb29ed259393a83e8fb5545c419543a85fc7bc9 (patch)
tree12bc057bf1d957ba2f07eff9c2641bdf687fa0df /src/gui/text/qtextengine.cpp
parent58408ffa1b9c0b42a1719d3c8a4d4c62dec4fce6 (diff)
Don't alter input string in QTextLayout with ShowLineAndParagraphSeparators
When ShowLineAndParagraphSeparators was set, we would replace the separator character in the user's string in some cases, since we never detached from the input string and just const_cast the pointer to the shared buffer. [ChangeLog][QtGui][Text] Fixed bug where a QTextLayout with ShowLineAndParagraphSeparators would modify the layout's input string. Task-number: QTBUG-42033 Change-Id: I92f9100b750f16e52b38b718245c13e5c4a0ebb9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/gui/text/qtextengine.cpp')
-rw-r--r--src/gui/text/qtextengine.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index d0c2779a65..17a91f5a6a 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1635,8 +1635,14 @@ void QTextEngine::itemize() const
if (analysis->bidiLevel % 2)
--analysis->bidiLevel;
analysis->flags = QScriptAnalysis::LineOrParagraphSeparator;
- if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
+ if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) {
+ const int offset = uc - string;
+ layoutData->string.detach();
+ string = reinterpret_cast<const ushort *>(layoutData->string.unicode());
+ uc = string + offset;
+ e = uc + length;
*const_cast<ushort*>(uc) = 0x21B5; // visual line separator
+ }
break;
case QChar::Tabulation:
analysis->flags = QScriptAnalysis::Tab;