diff options
| author | Tim Allen <screwtape@froup.com> | 2018-03-15 23:02:27 +1100 |
|---|---|---|
| committer | Tim Allen <screwtape@froup.com> | 2018-04-11 15:15:45 +1000 |
| commit | 50e422659bb1533da2d5f04bbd17de062dcad84b (patch) | |
| tree | 2c3c7fba8ec46a5491c0e27c6ea311952e2c0460 /src/ncurses_ui.cc | |
| parent | d846400279a1831d3d29a4dd179fbf799b4ee541 (diff) | |
Add support for the shift modifier.
Because keyboard layouts vary, the shift-modifier `<s-…>` is only supported
for special keys (like `<up>` and `<home>`) and for ASCII lowercase where
we assume the shift-modifier just produces the matching uppercase character.
Even that's not universally true, since in Turkish `i` and `I` are not an
uppercase/lowercase pair, but Kakoune's default keyboard mappings already
assume en-US mappings for mnemonic purposes.
Mappings of the form `<s-x>` are normalized to `<X>` when `x` is an ASCII
character. `<backtab>` is removed, since we can now say `<s-tab>`.
Diffstat (limited to 'src/ncurses_ui.cc')
| -rw-r--r-- | src/ncurses_ui.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index 42023ebb..e6863945 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -570,15 +570,24 @@ Optional<Key> NCursesUI::get_next_key() { case KEY_BACKSPACE: case 127: return {Key::Backspace}; case KEY_DC: return {Key::Delete}; + case KEY_SDC: return shift(Key::Delete); case KEY_UP: return {Key::Up}; + case KEY_SR: return shift(Key::Up); case KEY_DOWN: return {Key::Down}; + case KEY_SF: return shift(Key::Down); case KEY_LEFT: return {Key::Left}; + case KEY_SLEFT: return shift(Key::Left); case KEY_RIGHT: return {Key::Right}; + case KEY_SRIGHT: return shift(Key::Right); case KEY_PPAGE: return {Key::PageUp}; + case KEY_SPREVIOUS: return shift(Key::PageUp); case KEY_NPAGE: return {Key::PageDown}; + case KEY_SNEXT: return shift(Key::PageDown); case KEY_HOME: return {Key::Home}; + case KEY_SHOME: return shift(Key::Home); case KEY_END: return {Key::End}; - case KEY_BTAB: return {Key::BackTab}; + case KEY_SEND: return shift(Key::End); + case KEY_BTAB: return shift(Key::Tab); case KEY_RESIZE: return resize(m_dimensions); } |
