1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:28:11 +00:00

LibLine: Implement internal functions to jump cursor over non-space word

Two new internal functions `cursor_left_nonspace_word()` (`Ctrl+Alt+B`)
and `cursor_right_nonspace_word()` (`Ctrl+Alt+F`) that jump the cursor
left or right until a non-space character.

Same implementation as the alphanumeric word jump functions
`cursor_left_word()` (`Alt+B`) and `cursor_right_word()` (`Alt+F`).
This commit is contained in:
ronak69 2024-01-03 11:12:29 +00:00 committed by Ali Mohammad Pur
parent a6ce86a4b3
commit 97bcdba2a5
3 changed files with 39 additions and 0 deletions

View file

@ -166,6 +166,8 @@ void Editor::set_default_keybinds()
register_key_input_callback(Key { '.', Key::Alt }, EDITOR_INTERNAL_FUNCTION(insert_last_words));
register_key_input_callback(Key { 'b', Key::Alt }, EDITOR_INTERNAL_FUNCTION(cursor_left_word));
register_key_input_callback(Key { 'f', Key::Alt }, EDITOR_INTERNAL_FUNCTION(cursor_right_word));
register_key_input_callback(Key { ctrl('B'), Key::Alt }, EDITOR_INTERNAL_FUNCTION(cursor_left_nonspace_word));
register_key_input_callback(Key { ctrl('F'), Key::Alt }, EDITOR_INTERNAL_FUNCTION(cursor_right_nonspace_word));
// ^[^H: alt-backspace: backward delete word
register_key_input_callback(Key { '\b', Key::Alt }, EDITOR_INTERNAL_FUNCTION(erase_alnum_word_backwards));
register_key_input_callback(Key { 'd', Key::Alt }, EDITOR_INTERNAL_FUNCTION(erase_alnum_word_forwards));