diff options
| author | Chinmoy Ranjan Pradhan <[email protected]> | 2019-05-05 18:30:19 +0530 |
|---|---|---|
| committer | Chinmoy Ranjan Pradhan <[email protected]> | 2019-05-12 16:33:14 +0530 |
| commit | d7555d8e11311c16f6dadc14abd9b3fb9a03a085 (patch) | |
| tree | 6477d996816b8eeb9a502ea39c4aee58a7d62901 | |
| parent | 7bc3b748b36b65fc59d836d9bd4a89e9897c7554 (diff) | |
[Inline Rename] Move cursor to correct position on pressing Home and End
Summary:
When pressing home or end key on a wrapped file name the cursor should move to beginning or end of the whole file name
instead of the last line (which is the default behaviour of any textedit widget).
BUG: 363179
Reviewers: #dolphin, elvisangelaccio
Subscribers: kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D21031
| -rw-r--r-- | src/kitemviews/private/kitemlistroleeditor.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/kitemviews/private/kitemlistroleeditor.cpp b/src/kitemviews/private/kitemlistroleeditor.cpp index e79a9f9d1..eb6f1de76 100644 --- a/src/kitemviews/private/kitemlistroleeditor.cpp +++ b/src/kitemviews/private/kitemlistroleeditor.cpp @@ -107,6 +107,23 @@ void KItemListRoleEditor::keyPressEvent(QKeyEvent* event) } break; } + case Qt::Key_Home: + case Qt::Key_End: { + if (event->modifiers() == Qt::NoModifier || event->modifiers() == Qt::ShiftModifier) { + const QTextCursor::MoveOperation op = event->key() == Qt::Key_Home + ? QTextCursor::Start + : QTextCursor::End; + const QTextCursor::MoveMode mode = event->modifiers() == Qt::NoModifier + ? QTextCursor::MoveAnchor + : QTextCursor::KeepAnchor; + QTextCursor cursor = textCursor(); + cursor.movePosition(op, mode); + setTextCursor(cursor); + event->accept(); + return; + } + break; + } default: break; } |
