Mercurial > hg > nnchat
changeset 206:af32c038cf1e
Add some hardcoded translations for certain terminal keycodes that NCurses 4.x on Solaris didn't handle .. urgh.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 20 Nov 2010 19:14:22 +0200 |
parents | b1482bc34260 |
children | e0c085426b91 |
files | nnchat.c |
diffstat | 1 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/nnchat.c Sat Nov 20 12:21:22 2010 +0200 +++ b/nnchat.c Sat Nov 20 19:14:22 2010 +0200 @@ -1149,6 +1149,27 @@ printMsg("Unhandled ESC-O key sequence 0x%02x\n", c); break; } + } else + if (c == '[') { + c = wgetch(stdscr); + switch (c) { + case 0x32: c = KEY_IC; break; + case 0x33: c = KEY_DC; break; + + case 0x35: c = KEY_PPAGE; break; + case 0x36: c = KEY_NPAGE; break; + + case 0x37: c = KEY_HOME; break; + case 0x38: c = KEY_END; break; + + default: + printMsg("Unhandled ESC-[*~ key sequence 0x%02x\n", c); + c = ERR; + break; + } + /* Get the trailing ~ */ + if (c != ERR) + wgetch(stdscr); } else { printMsg("Unhandled ESC key sequence 0x%02x\n", c); continue; @@ -1251,6 +1272,7 @@ case KEY_BACKSPACE: case 0x08: + case 0x7f: nn_editbuf_delete(editBuf, editBuf->pos - 1); nn_editbuf_setpos(editBuf, editBuf->pos - 1); update = TRUE;