tweaks: move two functions to after the ones that they call
Этот коммит содержится в:
родитель
a9fb56a8c9
Коммит
40f6dbc34e
50
src/global.c
50
src/global.c
@ -272,19 +272,6 @@ size_t light_from_col = 0;
|
|||||||
size_t light_to_col = 0;
|
size_t light_to_col = 0;
|
||||||
/* Where the spotlighted text ends. */
|
/* 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. */
|
/* To make the functions and shortcuts lists clearer. */
|
||||||
#define VIEW TRUE /* Is allowed in view mode. */
|
#define VIEW TRUE /* Is allowed in view mode. */
|
||||||
#define NOVIEW FALSE
|
#define NOVIEW FALSE
|
||||||
@ -441,6 +428,19 @@ int the_code_for(void (*func)(void), int defaultval)
|
|||||||
return s->keycode;
|
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
|
/* Return the shortcut that corresponds to the values of kbinput (the
|
||||||
* key itself) and meta_key (whether the key is a meta sequence). 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
|
* returned shortcut will be the first in the list that corresponds to
|
||||||
@ -474,18 +474,6 @@ functionptrtype func_from_key(int *kbinput)
|
|||||||
return NULL;
|
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,
|
/* Parse the given keystring and return the corresponding keycode,
|
||||||
* or return -1 when the string is invalid. */
|
* or return -1 when the string is invalid. */
|
||||||
int keycode_from_string(const char *keystring)
|
int keycode_from_string(const char *keystring)
|
||||||
@ -521,6 +509,18 @@ int keycode_from_string(const char *keystring)
|
|||||||
return -1;
|
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. */
|
/* These two tags are used elsewhere too, so they are global. */
|
||||||
/* TRANSLATORS: Try to keep the next two strings at most 10 characters. */
|
/* TRANSLATORS: Try to keep the next two strings at most 10 characters. */
|
||||||
const char *exit_tag = N_("Exit");
|
const char *exit_tag = N_("Exit");
|
||||||
|
@ -317,9 +317,9 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Some functions in global.c. */
|
/* Some functions in global.c. */
|
||||||
size_t length_of_list(int menu);
|
|
||||||
const keystruct *first_sc_for(int menu, void (*func)(void));
|
const keystruct *first_sc_for(int menu, void (*func)(void));
|
||||||
int the_code_for(void (*func)(void), int defaultval);
|
int the_code_for(void (*func)(void), int defaultval);
|
||||||
|
size_t length_of_list(int menu);
|
||||||
const keystruct *get_shortcut(int *kbinput);
|
const keystruct *get_shortcut(int *kbinput);
|
||||||
functionptrtype func_from_key(int *kbinput);
|
functionptrtype func_from_key(int *kbinput);
|
||||||
int keycode_from_string(const char *keystring);
|
int keycode_from_string(const char *keystring);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user