From f29c5c3a416bd62298cbcdec428a3759956b37e7 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Thu, 6 Aug 2020 11:46:45 -0400 Subject: [PATCH] LibLine: Add Alt-d binding to forward-delete a word --- Libraries/LibLine/Editor.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Libraries/LibLine/Editor.cpp b/Libraries/LibLine/Editor.cpp index cf072b06ce..3e107b28ff 100644 --- a/Libraries/LibLine/Editor.cpp +++ b/Libraries/LibLine/Editor.cpp @@ -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;