path: root/src/calcurse.h
diff options
authorLars Henriksen <LarsHenriksen@get2net.dk>2020-12-27 23:30:48 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2021-04-11 19:46:11 -0400
commit338c640a19013152c90776494b3adf29a69de4a3 (patch)
treeded6fb08d644a1c251ba3fedbd38c1b897773ee2 /src/calcurse.h
parent6e6663c5dde69fe4928790fd44ed46c70e31215f (diff)
Allow undefined actions in keys configuration file
In the keys file there are three possibilities for each action: 1. One or several keys are assigned to it 2. It is marked as UNDEFINED (new) 3. It is missing from the file On load of the keys file, calcurse respectively 1. Assigns the key(s) 2. Assigns "UNDEFINED" (new) 3. Assigns a default key if possible If default keys were assigned, the user is informed of the number of actions affected, and the keys file is updated. After load each action must either have keys assigned or be undefined. If not, calcurse exits with a failure. If there are syntax/semantic errors in the file, calcurse rejects the file and exits. When an interactive user leaves the keys configuration menu, a warning is issued if any action is UNDEFINED. The keys file is always updated. Addresses GitHub issue #298. Additionally: Description of concepts and data structures used for keyboard keys and virtual keys (actions) as well as name changes and comments to improve readability. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/calcurse.h')
1 files changed, 17 insertions, 15 deletions
diff --git a/src/calcurse.h b/src/calcurse.h
index d5ba355..06deaa0 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -515,8 +515,8 @@ struct io_file {
char *name;
-/* Available keys. */
-enum key {
+/* Virtual keys. */
+enum vkey {
@@ -566,7 +566,7 @@ enum key {
/* Non-configurable, context sensitive key bindings. */
@@ -946,24 +946,26 @@ int io_get_modified(void);
void keys_init(void);
void keys_free(void);
void keys_dump_defaults(char *);
-const char *keys_get_label(enum key);
-enum key keys_get_action(int);
+const char *keys_get_label(enum vkey);
+const char *keys_get_binding(enum vkey);
+enum vkey keys_get_action(int);
int keys_wgetch(WINDOW *);
void keys_wait_for_any_key(WINDOW *);
-enum key keys_get(WINDOW *, int *, int *);
-int keys_assign_binding(int, enum key);
-void keys_remove_binding(int, enum key);
+enum vkey keys_get(WINDOW * win, int *, int *);
+int keys_assign_binding(int, enum vkey);
+void keys_remove_binding(int, enum vkey);
int keys_str2int(const char *);
char *keys_int2str(int);
-int keys_action_count_keys(enum key);
-const char *keys_action_firstkey(enum key);
-const char *keys_action_nkey(enum key, int);
-char *keys_action_allkeys(enum key);
+int keys_action_count_keys(enum vkey);
+const char *keys_action_firstkey(enum vkey);
+const char *keys_action_nkey(enum vkey, int);
+char *keys_action_allkeys(enum vkey);
void keys_display_bindings_bar(WINDOW *, int *, int, int, int);
-void keys_popup_info(enum key);
+void keys_popup_info(enum vkey);
void keys_save_bindings(FILE *);
-int keys_check_missing_bindings(void);
-void keys_fill_missing(void);
+int keys_check_missing(void);
+int keys_check_undefined(void);
+int keys_fill_missing(void);
/* listbox.c */
void listbox_init(struct listbox *, int, int, int, int, const char *,