LibLine: Add Alt-d binding to forward-delete a word
This commit is contained in:
parent
e521daeedc
commit
f29c5c3a41
Notes:
sideshowbarker
2024-07-19 04:13:02 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/f29c5c3a416 Pull-request: https://github.com/SerenityOS/serenity/pull/3026
1 changed files with 15 additions and 0 deletions
|
@ -571,6 +571,21 @@ void Editor::handle_read_event()
|
|||
do_cursor_left(Word);
|
||||
m_state = InputState::Free;
|
||||
continue;
|
||||
case 'd': // ^[d: alt-d
|
||||
{
|
||||
bool has_seen_nonspace = false;
|
||||
while (m_cursor < m_buffer.size()) {
|
||||
if (isspace(m_buffer[m_cursor])) {
|
||||
if (has_seen_nonspace)
|
||||
break;
|
||||
} else {
|
||||
has_seen_nonspace = true;
|
||||
}
|
||||
do_delete();
|
||||
}
|
||||
m_state = InputState::Free;
|
||||
continue;
|
||||
}
|
||||
case 'f': // ^[f: alt-f
|
||||
do_cursor_right(Word);
|
||||
m_state = InputState::Free;
|
||||
|
|
Loading…
Add table
Reference in a new issue