Merge pull request #346 from mklein-de/vikeys

vi keys: translate ALT-h/j/k/l to arrow keys
This commit is contained in:
Hisham Muhammad 2016-01-13 14:20:33 -02:00
commit 9c39422c71
1 changed files with 23 additions and 0 deletions

View File

@ -244,6 +244,29 @@ 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;
}
}
}
redraw = true;
if (Panel_eventHandlerFn(panelFocus)) {
result = Panel_eventHandler(panelFocus, ch);