dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit 41901a2fe51fc78a35827e3e6bc5613204711f95
parent 89fefa34a667ad7b789a6a96ebd0181b16d83173
Author: Marc Andre Tanner <mat@brain-dump.org>
Date:   Mon, 25 Feb 2008 17:20:58 +0100

Add a function which handles escape sequences from the keyboard.

This also contains a hack which makes the keypad work when used
with putty.

Diffstat:
madtty.c | 16++++++++++++++++
madtty.h | 1+
2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/madtty.c b/madtty.c @@ -1075,6 +1075,22 @@ void madtty_keypress(madtty_t *t, int keycode) term_write(t, &c, 1); } +void madtty_keypress_sequence(madtty_t *t, const char *seq) +{ + int key, len = strlen(seq); + /* check for function keys from putty, this makes the + * keypad work but it's probably not the right way to + * do it. the sequence we look for is \eO + a character + * representing the number. + */ + if(len == 3 && seq[0] == '\e' && seq[1] == 'O') { + key = seq[2] - 64; + if(key >= '0' && key <= '9') + madtty_keypress(t, key); + } else + term_write(t, seq, len); +} + void madtty_init_colors(void) { if (COLOR_PAIRS > 64) { diff --git a/madtty.h b/madtty.h @@ -68,6 +68,7 @@ unsigned madtty_cursor(madtty_t *t); int madtty_process(madtty_t *); void madtty_keypress(madtty_t *, int keycode); +void madtty_keypress_sequence(madtty_t *, const char *seq); void madtty_dirty(madtty_t *t); void madtty_draw(madtty_t *, WINDOW *win, int startrow, int startcol);