diff options
| author | Maxime Coste <mawww@kakoune.org> | 2020-11-01 10:11:12 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2020-11-01 10:11:12 +1100 |
| commit | f25442fbad826c074e8ec339b622e092eab3d3fd (patch) | |
| tree | 8dc8571b6eadcc9eb5906bc5a2302e1139d14ca6 /src | |
| parent | 5d6136483c55a272691301ca1421e93fe537fcde (diff) | |
| parent | c039879c82544e1c0bfb75b197ff76e6d73cd10a (diff) | |
Merge remote-tracking branch 'Screwtapello/map-ctrl-symbol-keys-ncurses' into master
Diffstat (limited to 'src')
| -rw-r--r-- | src/keys.cc | 4 | ||||
| -rw-r--r-- | src/ncurses_ui.cc | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/keys.cc b/src/keys.cc index 29fa9ce1..b6761584 100644 --- a/src/keys.cc +++ b/src/keys.cc @@ -229,6 +229,10 @@ UnitTest test_keys{[]() alt('j'), ctrl('r'), shift(Key::Up), + ctrl('['), + ctrl('\\'), + ctrl(']'), + ctrl('_'), }; String keys_as_str; for (auto& key : keys) diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index 14308c98..732f009f 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -623,8 +623,19 @@ Optional<Key> NCursesUI::get_next_key() kill(0, SIGTSTP); // We suspend at this line return {}; } + // Special case: you can type NUL with Ctrl-2 or Ctrl-Shift-2 or + // Ctrl-Backtick, but the most straightforward way is Ctrl-Space. + if (c == 0) + return ctrl(' '); + // Represent Ctrl-letter combinations in lower-case, to be clear + // that Shift is not involved. if (c < 27) return ctrl(c - 1 + 'a'); + // Represent Ctrl-symbol combinations in "upper-case", as they are + // traditionally-rendered. + // Note that Escape is handled elsewhere. + if (c < 32) + return ctrl(c - 1 + 'A'); struct Sentinel{}; struct CharIterator |
