diff options
author | mae <qt-info@nokia.com> | 2009-10-05 13:07:10 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-10-06 02:56:52 (GMT) |
commit | b8b407a1f19d0521db93e7e5a7fbd03db7f6825c (patch) | |
tree | 94c12ec18665cae56a43319afd29e32aea2df074 | |
parent | 4d1823e5a1e0f21dcf296700638db285376742da (diff) | |
download | Qt-b8b407a1f19d0521db93e7e5a7fbd03db7f6825c.zip Qt-b8b407a1f19d0521db93e7e5a7fbd03db7f6825c.tar.gz Qt-b8b407a1f19d0521db93e7e5a7fbd03db7f6825c.tar.bz2 |
Fix QKeySequence::DeleteEndOfWord and QKeySequence::DeleteStartOfWord
QTextControl showed inconsistent behaviour with DeleteEndOfWord and
DeleteStartOfWord when the cursor had a selection. With this patch,
the commands will simply delete the existing selection, which is
consistent behaviour with in other IDEs.
Reviewed-by: Simon Hausmann
(cherry picked from commit 6ce698050bbe9a4ec5198f1e08b94d51b8a6c9bd)
-rw-r--r-- | src/gui/text/qtextcontrol.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 6def06e..db4c07c 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1223,11 +1223,13 @@ void QTextControlPrivate::keyPressEvent(QKeyEvent *e) cursor.deleteChar(); } else if (e == QKeySequence::DeleteEndOfWord) { - cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor); + if (!cursor.hasSelection()) + cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor); cursor.removeSelectedText(); } else if (e == QKeySequence::DeleteStartOfWord) { - cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor); + if (!cursor.hasSelection()) + cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor); cursor.removeSelectedText(); } else if (e == QKeySequence::DeleteEndOfLine) { |