Pressing cursor keys did not clear selection

Creator got a feature that pressing cursor keys without effect did not
clear the selection. E.g. Left at position 0, or End at the end of a
block. This was not in sync with other editors. Pressing the cursor keys
without selection modifier should ALWAYS clear the selection.

Task-number: QTCREATORBUG-3327
This commit is contained in:
mae
2011-01-05 13:46:41 +01:00
parent 42a860351a
commit 2ec0eaf62d

View File

@@ -1469,21 +1469,18 @@ bool BaseTextEditor::cursorMoveKeyEvent(QKeyEvent *e)
bool visualNavigation = cursor.visualNavigation();
cursor.setVisualNavigation(true);
bool moved = false;
if (op == QTextCursor::WordRight) {
moved = camelCaseRight(cursor, mode);
camelCaseRight(cursor, mode);
} else if (op == QTextCursor::WordLeft) {
moved = camelCaseLeft(cursor, mode);
camelCaseLeft(cursor, mode);
} else {
moved = cursor.movePosition(op, mode);
cursor.movePosition(op, mode);
}
cursor.setVisualNavigation(visualNavigation);
if (moved) {
setTextCursor(cursor);
ensureCursorVisible();
}
setTextCursor(cursor);
ensureCursorVisible();
return true;
}