aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/pending/vi.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/toys/pending/vi.c b/toys/pending/vi.c
index 9906ca93..2fb6d442 100644
--- a/toys/pending/vi.c
+++ b/toys/pending/vi.c
@@ -909,9 +909,11 @@ void vi_main(void)
draw_page();
- while(1) {
+ for (;;) {
int key = scan_key(keybuf, -1);
+ if (key == -1) goto cleanup_vi;
+
terminal_size(&TT.screen_width, &TT.screen_height);
TT.screen_height -= 2; //TODO this is hack fix visual alignment
@@ -926,12 +928,6 @@ void vi_main(void)
continue;
}
- switch (key) {
- case -1:
- case 3:
- case 4:
- goto cleanup_vi;
- }
if (TT.vi_mode == 1) { //NORMAL
switch (key) {
case '/':