mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 04:04:35 +03:00
Fix behavior of ESC key, getting rid of the annoying delay.
Thank you @Explorer09 for the push! Closes #417.
This commit is contained in:
@ -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)) {
|
||||
|
Reference in New Issue
Block a user