From 72c003655c2009279d7360acce88d536122c8795 Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 5 Jun 2009 13:10:31 +0200 Subject: Made Selection updates relative to the block. Otherwise the update would always end up with the selection being in the first block. --- src/gui/text/qtextcontrol.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 6647558..69e1ee4 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1841,8 +1841,9 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) const QInputMethodEvent::Attribute &a = e->attributes().at(i); if (a.type == QInputMethodEvent::Selection) { QTextCursor oldCursor = cursor; - cursor.setPosition(a.start, QTextCursor::MoveAnchor); - cursor.setPosition(a.start + a.length, QTextCursor::KeepAnchor); + int blockStart = a.start + cursor.block().position(); + cursor.setPosition(blockStart, QTextCursor::MoveAnchor); + cursor.setPosition(blockStart + a.length, QTextCursor::KeepAnchor); q->ensureCursorVisible(); repaintOldAndNewSelection(oldCursor); } -- cgit v0.12