Skip to content

Commit

Permalink
For curses display, recognize a few more control keys
Browse files Browse the repository at this point in the history
The curses display handles most control-X keys, and translates
them into their corresponding keycode.  Here we recognize
a few that are missing, Ctrl-@ (null), Ctrl-\ (backslash),
Ctrl-] (right bracket), Ctrl-^ (caret), Ctrl-_ (underscore).

Signed-off-by: Sean Estabrooks <sean.estabrooks@gmail.com>
Message-id: CAHyVn3Bh9CRgDuOmf7G7Ngwamu8d4cVozAcB2i4ymnnggBXNmg@mail.gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
loops authored and pm215 committed Jul 25, 2023
1 parent 5d78893 commit 9b57954
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ui/curses_keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ static const int _curses2keycode[CURSES_CHARS] = {
['N' - '@'] = 49 | CNTRL, /* Control + n */
/* Control + m collides with the keycode for Enter */

['@' - '@'] = 3 | CNTRL, /* Control + @ */
/* Control + [ collides with the keycode for Escape */
['\\' - '@'] = 43 | CNTRL, /* Control + Backslash */
[']' - '@'] = 27 | CNTRL, /* Control + ] */
['^' - '@'] = 7 | CNTRL, /* Control + ^ */
['_' - '@'] = 12 | CNTRL, /* Control + Underscore */
};

static const int _curseskey2keycode[CURSES_KEYS] = {
Expand Down

0 comments on commit 9b57954

Please sign in to comment.