diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-02-13 19:13:44 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-02-13 19:13:44 +0000 |
| commit | 8c843f5bead8bbe459c8532a8c9b1cac7b811fb8 (patch) | |
| tree | b5da056ab807ff939e9e2e0204c3560ac32caa9b /src/input_handler.cc | |
| parent | 224f73d72a2d844fa16dbcf61108c5c3f9abf610 (diff) | |
Add <a-h>, <a-l>, <a-x> and <a-d> bindings to line editor
<a-h> : move cursor left
<a-l> : move cursor right
<a-x> : delete char before cursor
<a-d> : delete char under cursor
Diffstat (limited to 'src/input_handler.cc')
| -rw-r--r-- | src/input_handler.cc | 8 |
1 files 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) |
