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>
bb10
Konstantin Ritt 2014-04-03 03:55:45 +03:00 committed by The Qt Project
parent 6d39e87f34
commit d828672945
1 changed files with 7 additions and 8 deletions

View File

@ -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)