diff --git a/src/global.c b/src/global.c index 6868bd62..9bdbc0d0 100644 --- a/src/global.c +++ b/src/global.c @@ -272,19 +272,6 @@ size_t light_from_col = 0; size_t light_to_col = 0; /* Where the spotlighted text ends. */ -/* Return the number of entries in the shortcut list for a given menu. */ -size_t length_of_list(int menu) -{ - funcstruct *f; - size_t i = 0; - - for (f = allfuncs; f != NULL; f = f->next) - if ((f->menus & menu) && first_sc_for(menu, f->func) != NULL) - i++; - - return i; -} - /* To make the functions and shortcuts lists clearer. */ #define VIEW TRUE /* Is allowed in view mode. */ #define NOVIEW FALSE @@ -441,6 +428,19 @@ int the_code_for(void (*func)(void), int defaultval) return s->keycode; } +/* Return the number of entries in the shortcut list for a given menu. */ +size_t length_of_list(int menu) +{ + funcstruct *f; + size_t i = 0; + + for (f = allfuncs; f != NULL; f = f->next) + if ((f->menus & menu) && first_sc_for(menu, f->func) != NULL) + i++; + + return i; +} + /* Return the shortcut that corresponds to the values of kbinput (the * key itself) and meta_key (whether the key is a meta sequence). The * returned shortcut will be the first in the list that corresponds to @@ -474,18 +474,6 @@ functionptrtype func_from_key(int *kbinput) return NULL; } -/* Set the string and its corresponding keycode for the given shortcut s. */ -void assign_keyinfo(keystruct *s, const char *keystring, const int keycode) -{ - s->keystr = keystring; - s->meta = (keystring[0] == 'M' && keycode == 0); - - if (keycode) - s->keycode = keycode; - else - s->keycode = keycode_from_string(keystring); -} - /* Parse the given keystring and return the corresponding keycode, * or return -1 when the string is invalid. */ int keycode_from_string(const char *keystring) @@ -521,6 +509,18 @@ int keycode_from_string(const char *keystring) return -1; } +/* Set the string and its corresponding keycode for the given shortcut s. */ +void assign_keyinfo(keystruct *s, const char *keystring, const int keycode) +{ + s->keystr = keystring; + s->meta = (keystring[0] == 'M' && keycode == 0); + + if (keycode) + s->keycode = keycode; + else + s->keycode = keycode_from_string(keystring); +} + /* These two tags are used elsewhere too, so they are global. */ /* TRANSLATORS: Try to keep the next two strings at most 10 characters. */ const char *exit_tag = N_("Exit"); diff --git a/src/proto.h b/src/proto.h index 2a2ba967..68d3dc6d 100644 --- a/src/proto.h +++ b/src/proto.h @@ -317,9 +317,9 @@ char *input_tab(char *buf, bool allow_files, size_t *place, #endif /* Some functions in global.c. */ -size_t length_of_list(int menu); const keystruct *first_sc_for(int menu, void (*func)(void)); int the_code_for(void (*func)(void), int defaultval); +size_t length_of_list(int menu); const keystruct *get_shortcut(int *kbinput); functionptrtype func_from_key(int *kbinput); int keycode_from_string(const char *keystring);