From db991685deeff00073dafba885bd729ee359950b Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Wed, 12 Jun 2019 00:43:44 +0100 Subject: imv:handle_event small tidy up --- src/imv.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/imv.c b/src/imv.c index a49804f..84fc839 100644 --- a/src/imv.c +++ b/src/imv.c @@ -1137,21 +1137,21 @@ static void handle_event(struct imv *imv, SDL_Event *event) return; } - switch (event->key.keysym.sym) { - case SDLK_SEMICOLON: - if (event->key.keysym.mod & KMOD_SHIFT) { - SDL_StartTextInput(); - imv->input_buffer = malloc(command_buffer_len); - imv->input_buffer[0] = '\0'; - imv->need_redraw = true; - } - break; - default: { /* braces to allow const char *cmd definition */ - struct list *cmds = imv_bind_handle_event(imv->binds, event); - if (cmds) { - imv_command_exec_list(imv->commands, cmds, imv); - } - } + /* Hitting : opens command-entry mode, like vim */ + if (event->key.keysym.sym == SDLK_SEMICOLON + && event->key.keysym.mod & KMOD_SHIFT) { + SDL_StartTextInput(); + imv->input_buffer = malloc(command_buffer_len); + imv->input_buffer[0] = '\0'; + imv->need_redraw = true; + return; + } + + /* If none of the above, add the key to the current key sequence and + * see if that triggers a bind */ + struct list *cmds = imv_bind_handle_event(imv->binds, event); + if (cmds) { + imv_command_exec_list(imv->commands, cmds, imv); } break; case SDL_MOUSEWHEEL: -- cgit v1.2.3