From 6dc85408cdf2341f8b7c0911abfb3bb6a37021a8 Mon Sep 17 00:00:00 2001 From: Pasi Matilainen Date: Mon, 16 Jan 2012 09:10:18 +0200 Subject: QTextEdit cursor position fix when moving left/right with selection When text has been selected in a QTextEdit and the left or right arrow key is pressed, the cursor moves one character beyond the start or end of the selection, when it shouldn't move past the selection. Fixed by moving the cursor to the right place when a selection is active. Task-number: QTBUG-22853 Change-Id: I9ea1863436db98627a6fd041ce554cf10be26493 Reviewed-by: Jiang Jiang (cherry picked from commit 1b031759ddfdab9703dfecac13f1ed318da3dafe) --- tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto/widgets/widgets/qplaintextedit') diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index 1b483512e3..615e4453bc 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp @@ -1474,11 +1474,11 @@ void tst_QPlainTextEdit::selectionChanged() QCOMPARE(selectionChangedSpy.count(), 3); QTest::keyClick(ed, Qt::Key_Right); - QCOMPARE(ed->textCursor().position(), 5); + QCOMPARE(ed->textCursor().position(), 4); QCOMPARE(selectionChangedSpy.count(), 4); QTest::keyClick(ed, Qt::Key_Right); - QCOMPARE(ed->textCursor().position(), 6); + QCOMPARE(ed->textCursor().position(), 5); QCOMPARE(selectionChangedSpy.count(), 4); } -- cgit v1.2.3