dvtm

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

commit 7e8027149aa462a48401da31d04c347fd4a970a6
parent fa9d946d25148f9a365aaeee791bf6018417e44a
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu,  5 Jan 2017 15:07:40 +0100

Improve handling of Alt + Special key

Trying to treat curses symbolic key (KEY_*) constants normal chars is obviously
nonsense. In general the input handling code is a bit of a mess and needs to be
overhauled at some point.

This should fix Alt+Backspace handling.

Close #36

Diffstat:
dvtm.c | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/dvtm.c b/dvtm.c @@ -866,14 +866,20 @@ viewprevtag(const char *args[]) { static void keypress(int code) { + int key = -1; unsigned int len = 1; char buf[8] = { '\e' }; if (code == '\e') { /* pass characters following escape to the underlying app */ nodelay(stdscr, TRUE); - for (int t; len < sizeof(buf) && (t = getch()) != ERR; len++) + for (int t; len < sizeof(buf) && (t = getch()) != ERR; len++) { + if (t > 255) { + key = t; + break; + } buf[len] = t; + } nodelay(stdscr, FALSE); } @@ -884,6 +890,8 @@ keypress(int code) { vt_write(c->term, buf, len); else vt_keypress(c->term, code); + if (key != -1) + vt_keypress(c->term, key); } if (!runinall) break;