From 002dfe5b40524bfd4c26566da8fea835eefcb096 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Wed, 21 Apr 2010 22:15:08 -0400 Subject: [PATCH] Allow built-in run requests to be unbound By adding built-in run requests after loading config files and checking if each of them conflicts with an existing keybinding. Reported by Simon Ruderich. --- NEWS | 1 + tig.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 59d7489..d03fea8 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,7 @@ Bug fixes: - Fix parsing of boolean show-date values. - Fix relative date. - Fix unbind to behave as if the keybinding was never defined. + - Fix unbind to also cover built-in run requests. - Fix parsing of unknown keymap names. tig-0.15 diff --git a/tig.c b/tig.c index 49ef437..7eb9f71 100644 --- a/tig.c +++ b/tig.c @@ -1762,8 +1762,10 @@ add_builtin_run_requests(void) int i; for (i = 0; i < ARRAY_SIZE(reqs); i++) { - enum request req; + enum request req = get_keybinding(reqs[i].keymap, reqs[i].key); + if (req != reqs[i].key) + continue; req = add_run_request(reqs[i].keymap, reqs[i].key, reqs[i].argc, reqs[i].argv); if (req != REQ_NONE) add_keybinding(reqs[i].keymap, req, reqs[i].key); @@ -2137,8 +2139,6 @@ load_options(void) const char *tigrc_system = getenv("TIGRC_SYSTEM"); char buf[SIZEOF_STR]; - add_builtin_run_requests(); - if (!tigrc_system) tigrc_system = SYSCONFDIR "/tigrc"; load_option_file(tigrc_system); @@ -2150,6 +2150,10 @@ load_options(void) } load_option_file(tigrc_user); + /* Add _after_ loading config files to avoid adding run requests + * that conflict with keybindings. */ + add_builtin_run_requests(); + return OK; } -- 2.30.2