diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-07-09 14:54:23 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-07-09 16:41:45 +0200 |
| commit | 9e7cb40b1f527c1bf431d4ca6c9b9ca4e70b5459 (patch) | |
| tree | 9a6665f3a757d4c91bb3bfac210e16ed2bacf6dc /vis.c | |
| parent | 66f5700d201c9456f917507db77a88115f38961c (diff) | |
| download | vis-9e7cb40b1f527c1bf431d4ca6c9b9ca4e70b5459.tar.gz vis-9e7cb40b1f527c1bf431d4ca6c9b9ca4e70b5459.tar.xz | |
ui: move input handling code to ui specific files
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 29 |
1 files changed, 1 insertions, 28 deletions
@@ -2268,36 +2268,9 @@ static void keypress(Key *key) { } static Key getkey(void) { - Key key = { .str = "", .code = 0 }; - int keycode = getch(), cur = 0; - if (keycode == ERR) - return key; - - if (keycode >= KEY_MIN) { - key.code = keycode; - } else { - key.str[cur++] = keycode; - int len = 1; - unsigned char keychar = keycode; - if (ISASCII(keychar)) len = 1; - else if (keychar == 0x1B || keychar >= 0xFC) len = 6; - else if (keychar >= 0xF8) len = 5; - else if (keychar >= 0xF0) len = 4; - else if (keychar >= 0xE0) len = 3; - else if (keychar >= 0xC0) len = 2; - len = MIN(len, LENGTH(key.str)); - - if (cur < len) { - nodelay(stdscr, TRUE); - for (int t; cur < len && (t = getch()) != ERR; cur++) - key.str[cur] = t; - nodelay(stdscr, FALSE); - } - } - + Key key = vis->ui->getkey(vis->ui); if (config->keypress && !config->keypress(&key)) return (Key){ .str = "", .code = 0 }; - return key; } |
