summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2017-09-03 15:44:55 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2017-09-03 15:51:01 +0200
commit8373ecfe5137a42035ce472eb47e84391b10a2c4 (patch)
tree973b36936bce87d99620d8bda3b17a69d3ca47e3 /src
parent6521d8cc0aaf82d6f3d707af4c182f30b7623f74 (diff)
downloadcalcurse-8373ecfe5137a42035ce472eb47e84391b10a2c4.tar.gz
calcurse-8373ecfe5137a42035ce472eb47e84391b10a2c4.zip
Improve default selection when editing key bindings
When adding a new key binding, automatically select the new binding. When removing a key binding, keep the selection index (unless the last binding of a row is removed). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src')
-rw-r--r--src/custom.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/custom.c b/src/custom.c
index 7e75e51..8688245 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -1014,13 +1014,13 @@ void custom_keys_config(void)
selelm,
LINESPERKEY);
wins_scrollwin_display(&kwin);
+ } else {
+ nbrowelm++;
+ selelm = nbrowelm - 1;
}
delwin(grabwin);
}
while (used || not_recognized);
- nbrowelm++;
- if (selelm < nbrowelm - 1)
- selelm++;
#undef WINROW
#undef WINCOL
break;
@@ -1029,7 +1029,7 @@ void custom_keys_config(void)
ch = keys_str2int(keystr);
keys_remove_binding(ch, selrow);
nbrowelm--;
- if (selelm > 0 && selelm <= nbrowelm)
+ if (selelm > 0 && selelm >= nbrowelm)
selelm--;
break;
case KEY_GENERIC_QUIT: