From: Jonas Fonseca Date: Thu, 22 Apr 2010 02:34:12 +0000 (-0400) Subject: When adding a keybinding check if the key is already bound X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1e27747895fa12b047dcd5248a75e71cc3bf67fa;p=tig.git When adding a keybinding check if the key is already bound ... and then overwrite it with the new request. --- 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)