aboutsummaryrefslogtreecommitdiffstats
path: root/src/custom.c
diff options
context:
space:
mode:
authorMichael Smith <crazedpsyc@mail4us.net>2013-02-04 19:03:52 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2013-02-04 20:06:09 +0100
commitce22b13a4dc435cdbe72304917b4d53932bcbdef (patch)
tree64a8445ed7141dd85ac090a1db6b4db823d26aea /src/custom.c
parentd5cbe794e990d6b5e9d68551496adf22218cfc63 (diff)
downloadcalcurse-ce22b13a4dc435cdbe72304917b4d53932bcbdef.tar.gz
calcurse-ce22b13a4dc435cdbe72304917b4d53932bcbdef.zip
Close key binding window when reassigning the same key
This allows for canceling a key reassignment. We cannot use a static key here since every key could potentially be used in a binding. Instead, just cancel if we are trying to reassign a key that has already been used for that action before. Signed-off-by: Michael Smith <crazedpsyc@mail4us.net> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/custom.c')
-rw-r--r--src/custom.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/custom.c b/src/custom.c
index df7feef..d569f00 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -980,6 +980,12 @@ void custom_keys_config(void)
} else
not_recognized = 0;
+ /* Is the binding used by this action already? If so, just end the reassignment */
+ if (selrow == keys_get_action(keyval)) {
+ delwin(grabwin);
+ break;
+ }
+
used = keys_assign_binding(keyval, selrow);
if (used) {
enum key action;