summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8f0cd8f)
raw | patch | inline | side by side (parent: 8f0cd8f)
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Wed, 28 Dec 2011 22:04:36 +0000 (23:04 +0100) | ||
committer | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Wed, 28 Dec 2011 22:04:36 +0000 (23:04 +0100) |
src/screen_keydef.c | patch | blob | history |
diff --git a/src/screen_keydef.c b/src/screen_keydef.c
index 87c5067c301864539b1cd56b94e0f3678f737f27..083696460a81cc3215985bdbd40c2229711be94d 100644 (file)
--- a/src/screen_keydef.c
+++ b/src/screen_keydef.c
wrefresh(lw->w);
}
+static void
+switch_to_subcmd_mode(int cmd)
+{
+ assert(subcmd == -1);
+
+ subcmd = cmd;
+ list_window_reset(lw);
+ check_subcmd_length();
+
+ keydef_repaint();
+}
+
+static void
+switch_to_command_mode(void)
+{
+ assert(subcmd != -1);
+
+ list_window_set_length(lw, command_length);
+ list_window_set_cursor(lw, subcmd);
+ subcmd = -1;
+
+ keydef_repaint();
+}
+
/**
* Delete a key from a given command's definition
* @param cmd_index the command
apply_keys();
save_keys();
} else {
- subcmd = lw->selected;
- list_window_reset(lw);
- check_subcmd_length();
-
- keydef_repaint();
+ switch_to_subcmd_mode(lw->selected);
}
} else {
if (lw->selected == subcmd_item_up) {
- list_window_set_length(lw, command_length);
- list_window_set_cursor(lw, subcmd);
- subcmd = -1;
-
- keydef_repaint();
+ switch_to_command_mode();
} else if (lw->selected == subcmd_item_add) {
add_key(subcmd);
} else {
}
return true;
case CMD_GO_PARENT_DIRECTORY:
- if (subcmd != -1) {
- list_window_set_length(lw, command_length);
- list_window_set_cursor(lw, subcmd);
- subcmd = -1;
-
- keydef_repaint();
- }
+ if (subcmd != -1)
+ switch_to_command_mode();
return true;
case CMD_DELETE:
if (subcmd != -1 && subcmd_item_is_key(lw->selected))