commit a9fb56a8c90fa8e8d1e011b7ce9339587171b5e1
parent 07c0d292765766f85a9e2574e46ee6c82af049c0
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 27 Sep 2019 17:41:17 +0200
tweaks: move a function to a better file, to be amongst its kind
Diffstat:
3 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/src/global.c b/src/global.c
@@ -441,6 +441,28 @@ int the_code_for(void (*func)(void), int defaultval)
return s->keycode;
}
+/* 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
+ * the given sequence. */
+const keystruct *get_shortcut(int *kbinput)
+{
+ keystruct *s;
+
+ /* Plain characters cannot be shortcuts, so just skip those. */
+ if (!meta_key && ((*kbinput >= 0x20 && *kbinput < 0x7F) ||
+ (*kbinput >= 0xA0 && *kbinput <= 0xFF)))
+ return NULL;
+
+ for (s = sclist; s != NULL; s = s->next) {
+ if ((s->menus & currmenu) && *kbinput == s->keycode &&
+ meta_key == s->meta)
+ return s;
+ }
+
+ return NULL;
+}
+
/* Return a pointer to the function that is bound to the given key. */
functionptrtype func_from_key(int *kbinput)
{
diff --git a/src/proto.h b/src/proto.h
@@ -320,6 +320,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
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);
+const keystruct *get_shortcut(int *kbinput);
functionptrtype func_from_key(int *kbinput);
int keycode_from_string(const char *keystring);
void assign_keyinfo(keystruct *s, const char *keystring, const int keycode);
@@ -617,7 +618,6 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count);
#ifdef ENABLE_MOUSE
int get_mouseinput(int *mouse_row, int *mouse_col, bool allow_shortcuts);
#endif
-const keystruct *get_shortcut(int *kbinput);
void blank_edit(void);
void blank_statusbar(void);
void wipe_statusbar(void);
diff --git a/src/winio.c b/src/winio.c
@@ -1768,28 +1768,6 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
}
#endif /* ENABLE_MOUSE */
-/* 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
- * the given sequence. */
-const keystruct *get_shortcut(int *kbinput)
-{
- keystruct *s;
-
- /* Plain characters cannot be shortcuts, so just skip those. */
- if (!meta_key && ((*kbinput >= 0x20 && *kbinput < 0x7F) ||
- (*kbinput >= 0xA0 && *kbinput <= 0xFF)))
- return NULL;
-
- for (s = sclist; s != NULL; s = s->next) {
- if ((s->menus & currmenu) && *kbinput == s->keycode &&
- meta_key == s->meta)
- return s;
- }
-
- return NULL;
-}
-
/* Move (in the given window) to the given row and wipe it clean. */
void blank_row(WINDOW *window, int row)
{