diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2019-06-12 00:43:44 +0100 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2019-06-12 01:43:14 +0100 |
commit | db991685deeff00073dafba885bd729ee359950b (patch) | |
tree | 6caae66052901edb42c614ac664d7c2d483098df /src | |
parent | aa1a495a60ec335fcc1ee85dbe5b659d12d15d6e (diff) | |
download | imv-db991685deeff00073dafba885bd729ee359950b.tar.gz |
imv:handle_event small tidy up
Diffstat (limited to 'src')
-rw-r--r-- | src/imv.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -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: |