From 1e27747895fa12b047dcd5248a75e71cc3bf67fa Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Wed, 21 Apr 2010 22:34:12 -0400 Subject: [PATCH] When adding a keybinding check if the key is already bound ... and then overwrite it with the new request. --- tig.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tig.c b/tig.c index 7eb9f71..0c57533 100644 --- a/tig.c +++ b/tig.c @@ -1522,6 +1522,14 @@ static void add_keybinding(enum keymap keymap, enum request request, int key) { struct keybinding_table *table = &keybindings[keymap]; + size_t i; + + for (i = 0; i < keybindings[keymap].size; i++) { + if (keybindings[keymap].data[i].alias == key) { + keybindings[keymap].data[i].request = request; + return; + } + } table->data = realloc(table->data, (table->size + 1) * sizeof(*table->data)); if (!table->data) -- 2.30.2