Fix cursor truncate to include line position

Since we could have moved the line position (QTextLine::setPosition),
the truncating position should be adjusted with that.

Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
(cherry picked from commit ca89c49fa2c5cbb3945897046f33eed9f7da846c)

Change-Id: I89ea1a3776a50732181bdfea9e79b4dddef950d4
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
This commit is contained in:
Jiang Jiang 2012-07-03 10:17:49 +02:00 committed by Qt by Nokia
parent 43850e5295
commit aee1702b13

View File

@ -2710,8 +2710,8 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
x += eng->offsetInLigature(si, pos, end, glyph_pos);
}
if (eng->option.wrapMode() != QTextOption::NoWrap && x > line.width)
x = line.width;
if (eng->option.wrapMode() != QTextOption::NoWrap && x > line.x + line.width)
x = line.x + line.width;
if (eng->option.wrapMode() != QTextOption::NoWrap && x < 0)
x = 0;