tweaks: move a function to a better file, to be amongst its kind
parent
07c0d29276
commit
a9fb56a8c9
22
src/global.c
22
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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
22
src/winio.c
22
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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue