aboutsummaryrefslogtreecommitdiff
path: root/src/imv.c
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2019-06-12 00:43:44 +0100
committerHarry Jeffery <harry@exec64.co.uk>2019-06-12 01:43:14 +0100
commitdb991685deeff00073dafba885bd729ee359950b (patch)
tree6caae66052901edb42c614ac664d7c2d483098df /src/imv.c
parentaa1a495a60ec335fcc1ee85dbe5b659d12d15d6e (diff)
downloadimv-db991685deeff00073dafba885bd729ee359950b.tar.gz
imv:handle_event small tidy up
Diffstat (limited to 'src/imv.c')
-rw-r--r--src/imv.c30
1 files 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: