summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorhuttongrabiel <huttonthomas@icloud.com>2022-10-07 20:17:00 -0700
committerAndrew Kaster <andrewdkaster@gmail.com>2022-10-12 09:46:18 -0600
commit6926991a56d3a113bd9dd6b92222c0351d63dc6f (patch)
tree8d55e618ed8a6a4357c59251a349a97d129176c4 /Userland
parent166a905951023a4c183a196ef444e689fdfa9697 (diff)
downloadserenity-6926991a56d3a113bd9dd6b92222c0351d63dc6f.zip
LibGUI: Delete from current position to end of line in VimEditingEngine
When in normal mode pressing Shift+D will delete from the current cursor position to the end of the line. Leaving the cursor on the character before where the cursor was when the deletion took place.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGUI/VimEditingEngine.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/VimEditingEngine.cpp b/Userland/Libraries/LibGUI/VimEditingEngine.cpp
index d2e82014e1..941b512e16 100644
--- a/Userland/Libraries/LibGUI/VimEditingEngine.cpp
+++ b/Userland/Libraries/LibGUI/VimEditingEngine.cpp
@@ -963,6 +963,11 @@ bool VimEditingEngine::on_key_in_normal_mode(KeyEvent const& event)
move_to_logical_line_end();
switch_to_insert_mode();
return true;
+ case (KeyCode::Key_D):
+ m_editor->delete_text_range({ m_editor->cursor(), { m_editor->cursor().line(), m_editor->current_line().length() } });
+ if (m_editor->cursor().column() != 0)
+ move_one_left();
+ break;
case (KeyCode::Key_I):
move_to_logical_line_beginning();
switch_to_insert_mode();