Fix behavior of ESC key, getting rid of the annoying delay.

Thank you @Explorer09 for the push!
Closes #417.
This commit is contained in:
Hisham
2016-02-19 13:38:02 -02:00
parent 48254f92e4
commit c23d4f12d1
4 changed files with 17 additions and 22 deletions

View File

@ -189,6 +189,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
}
int prevCh = ch;
ESCDELAY = 25;
ch = getch();
HandlerResult result = IGNORED;
@ -244,28 +245,11 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
redraw = false;
continue;
}
else if (ch == 27) {
int ch2 = getch();
if (ch2 != ERR) {
switch(ch2)
{
case 'h':
ch = KEY_LEFT;
break;
case 'j':
ch = KEY_DOWN;
break;
case 'k':
ch = KEY_UP;
break;
case 'l':
ch = KEY_RIGHT;
break;
default:
ungetch(ch2);
break;
}
}
switch (ch) {
case KEY_ALT('H'): ch = KEY_LEFT; break;
case KEY_ALT('J'): ch = KEY_DOWN; break;
case KEY_ALT('K'): ch = KEY_UP; break;
case KEY_ALT('L'): ch = KEY_RIGHT; break;
}
redraw = true;
if (Panel_eventHandlerFn(panelFocus)) {