From 8c843f5bead8bbe459c8532a8c9b1cac7b811fb8 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 13 Feb 2015 19:13:44 +0000 Subject: [PATCH] Add , , and bindings to line editor : move cursor left : move cursor right : delete char before cursor : delete char under cursor --- src/input_handler.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/input_handler.cc b/src/input_handler.cc index c0d1c11f..499778e8 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -242,12 +242,12 @@ class LineEditor public: void handle_key(Key key) { - if (key == Key::Left) + if (key == Key::Left or key == alt('h')) { if (m_cursor_pos > 0) --m_cursor_pos; } - else if (key == Key::Right) + else if (key == Key::Right or key == alt('l')) { if (m_cursor_pos < m_line.char_length()) ++m_cursor_pos; @@ -256,7 +256,7 @@ public: m_cursor_pos = 0; else if (key == Key::End) m_cursor_pos = m_line.char_length(); - else if (key == Key::Backspace) + else if (key == Key::Backspace or key == alt('x')) { if (m_cursor_pos != 0) { @@ -266,7 +266,7 @@ public: --m_cursor_pos; } } - else if (key == Key::Delete) + else if (key == Key::Delete or key == alt('d')) { if (m_cursor_pos != m_line.char_length()) m_line = m_line.substr(0, m_cursor_pos)