summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-01-24 18:09:38 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2011-01-25 12:37:07 (GMT)
commit388c57c0a1f53cd4a98aa12841eac603332dfe54 (patch)
tree2dbbad85de0d47e0ff3bff2d1a273fac66542159 /src
parent90046a56e8dbf1ee3931ce0caeb606a6f7d2dc45 (diff)
downloadQt-388c57c0a1f53cd4a98aa12841eac603332dfe54.zip
Qt-388c57c0a1f53cd4a98aa12841eac603332dfe54.tar.gz
Qt-388c57c0a1f53cd4a98aa12841eac603332dfe54.tar.bz2
Fix cursor position adjustment when removing strings
Commit 0ba1b4d0 introduced a regression to QTextDocument: it postponed cursor position adjustment until the move operation is done, but contentsChanged will be triggered by finishEdit() in this move operation, thus cursor positions in this signal handler will be in inconsistent states (normally we should first update cursor position then trigger contentsChanged). In this case we should also postpone finishEdit() handling after cursor positions have been adjusted, then the states expose to applications will be consistent. Task-number: QTBUG-15857 Reviewed-by: Eskil
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextdocument_p.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 498a432..2172f74 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -663,7 +663,8 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
Q_ASSERT(blocks.length() == fragments.length());
- finishEdit();
+ if (!blockCursorAdjustment)
+ finishEdit();
}
void QTextDocumentPrivate::remove(int pos, int length, QTextUndoCommand::Operation op)
@@ -678,6 +679,7 @@ void QTextDocumentPrivate::remove(int pos, int length, QTextUndoCommand::Operati
curs->changed = true;
}
}
+ finishEdit();
}
void QTextDocumentPrivate::setCharFormat(int pos, int length, const QTextCharFormat &newFormat, FormatChangeMode mode)