summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2009-09-23 13:28:24 (GMT)
committermae <qt-info@nokia.com>2009-09-23 13:40:56 (GMT)
commitbfdee5f1658b1bac4a0d1b93c5a45dbc6709f9e3 (patch)
treef932576dd3d0fbbceff65a8648e5bb764f62d82c /src
parente97b99f249ed65c6cedfc23f751a9834641271cb (diff)
downloadQt-bfdee5f1658b1bac4a0d1b93c5a45dbc6709f9e3.zip
Qt-bfdee5f1658b1bac4a0d1b93c5a45dbc6709f9e3.tar.gz
Qt-bfdee5f1658b1bac4a0d1b93c5a45dbc6709f9e3.tar.bz2
QTextCursor selection extension when inserting characters
The change makes QTextCursor not extend the selection when inserting characters at the end of the selection, provided that the cursor position is at the end. Reviewed-by: Simon Hausmann Reviewed-by: Roberto Raggi
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextcursor.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 8b85d2d..ce62834 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -92,8 +92,12 @@ QTextCursorPrivate::AdjustResult QTextCursorPrivate::adjustPosition(int position
{
QTextCursorPrivate::AdjustResult result = QTextCursorPrivate::CursorMoved;
// not(!) <= , so that inserting text adjusts the cursor correctly
- if (position < positionOfChange ||
- (position == positionOfChange && op == QTextUndoCommand::KeepCursor)) {
+ if (position < positionOfChange
+ || (position == positionOfChange
+ && (op == QTextUndoCommand::KeepCursor
+ || anchor < position)
+ )
+ ) {
result = CursorUnchanged;
} else {
if (charsAddedOrRemoved < 0 && position < positionOfChange - charsAddedOrRemoved)