diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2014-04-03 03:55:45 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-04 19:32:21 +0200 |
commit | d8286729451ce18f07d47a5bc3f5af08eda860fa (patch) | |
tree | 70d51edaaa19b4b8f00a41db62bd77a80374c9f7 /src/gui/text/qtextengine.cpp | |
parent | 6d39e87f340b46637633a34fc32a72c38356473b (diff) |
QTextEngine: Fix visual position movement for tab and object cases
QTextLineItemIterator::next() was never updating itemStart and itemEnd
for QScriptAnalysis::TabOrObject, thus producing incorrect
insertion points for the line that contains tabs and/or objects.
Change-Id: Ia964c663cc0636ba6be4500702656f989b252fba
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/gui/text/qtextengine.cpp')
-rw-r--r-- | src/gui/text/qtextengine.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 3b079b7ee3..7390b566e7 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -3520,7 +3520,12 @@ QScriptItem &QTextLineItemIterator::next() if (!si->num_glyphs) eng->shape(item); + itemStart = qMax(line.from, si->position); + itemEnd = qMin(lineEnd, si->position + itemLength); + if (si->analysis.flags >= QScriptAnalysis::TabOrObject) { + glyphsStart = 0; + glyphsEnd = 1; itemWidth = si->width; return *si; } @@ -3528,15 +3533,9 @@ QScriptItem &QTextLineItemIterator::next() unsigned short *logClusters = eng->logClusters(si); QGlyphLayout glyphs = eng->shapedGlyphs(si); - itemStart = qMax(line.from, si->position); glyphsStart = logClusters[itemStart - si->position]; - if (lineEnd < si->position + itemLength) { - itemEnd = lineEnd; - glyphsEnd = logClusters[itemEnd-si->position]; - } else { - itemEnd = si->position + itemLength; - glyphsEnd = si->num_glyphs; - } + glyphsEnd = (itemEnd == si->position + itemLength) ? si->num_glyphs : logClusters[itemEnd - si->position]; + // show soft-hyphen at line-break if (si->position + itemLength >= lineEnd && eng->layoutData->string.at(lineEnd - 1).unicode() == QChar::SoftHyphen) |