From aee1702b136f5d7c332e9963a400ff9128bcb5b6 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 3 Jul 2012 10:17:49 +0200 Subject: [PATCH] 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 (cherry picked from commit ca89c49fa2c5cbb3945897046f33eed9f7da846c) Change-Id: I89ea1a3776a50732181bdfea9e79b4dddef950d4 Reviewed-by: Jiang Jiang --- src/gui/text/qtextlayout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index b8be991fa1a..c269eb2afd7 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -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;