LibLine: Add Alt-d binding to forward-delete a word

This commit is contained in:
Nico Weber 2020-08-06 11:46:45 -04:00 committed by Andreas Kling
parent e521daeedc
commit f29c5c3a41
Notes: sideshowbarker 2024-07-19 04:13:02 +09:00

View file

@ -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;