diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/binds.c | 6 | ||||
-rw-r--r-- | src/binds.h | 3 | ||||
-rw-r--r-- | src/imv.c | 8 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/binds.c b/src/binds.c index 23ee43f..f1c4c65 100644 --- a/src/binds.c +++ b/src/binds.c @@ -121,6 +121,12 @@ enum bind_result imv_binds_add(struct imv_binds *binds, const struct list *keys, return result; } +void imv_binds_clear(struct imv_binds *binds) +{ + destroy_bind_node(&binds->bind_tree); + init_bind_node(&binds->bind_tree); +} + enum lookup_result { LOOKUP_PARTIAL, LOOKUP_INVALID, diff --git a/src/binds.h b/src/binds.h index cf41c74..05810d8 100644 --- a/src/binds.h +++ b/src/binds.h @@ -22,6 +22,9 @@ void imv_binds_free(struct imv_binds *binds); /* Create a key binding */ enum bind_result imv_binds_add(struct imv_binds *binds, const struct list *keys, const char *cmd); +/* Remove all key bindings */ +void imv_binds_clear(struct imv_binds *binds); + /* Fetch the list of keys pressed so far */ const struct list *imv_bind_input_buffer(struct imv_binds *binds); @@ -924,9 +924,17 @@ bool imv_load_config(struct imv *imv) } else if(!strcmp(key, "overlay_font")) { free(imv->font_name); imv->font_name = strdup(value); + } else if(!strcmp(key, "default_binds")) { + const bool default_binds = parse_bool(value); + if(!default_binds) { + /* clear out any default binds if requested */ + imv_binds_clear(imv->binds); + } } else { fprintf(stderr, "Ignoring unknown option: %s\n", key); } + } else if(sect == CFG_BINDS) { + add_bind(imv, key, value); } } } while(type); |