tweaks: rename two empty functions, to be more to the point

Also, move them to global.c, where all the other empty functions are.
This commit is contained in:
Benno Schulenberg 2021-10-09 17:30:33 +02:00
parent 87cde1590d
commit e9f0597e2e
5 changed files with 26 additions and 24 deletions

View File

@ -291,6 +291,14 @@ void regexp_void(void)
void backwards_void(void)
{
}
#ifdef ENABLE_HISTORIES
void get_older_item(void)
{
}
void get_newer_item(void)
{
}
#endif
void flip_replace(void)
{
}
@ -851,9 +859,9 @@ void shortcut_init(void)
N_("No Replace"), WITHORSANS(whereis_gist), BLANKAFTER, VIEW);
#ifdef ENABLE_HISTORIES
add_to_funcs(get_history_older_void, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE,
add_to_funcs(get_older_item, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE,
N_("Older"), WITHORSANS(older_gist), TOGETHER, VIEW);
add_to_funcs(get_history_newer_void, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE,
add_to_funcs(get_newer_item, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE,
N_("Newer"), WITHORSANS(newer_gist), BLANKAFTER, VIEW);
#endif
@ -1426,17 +1434,17 @@ void shortcut_init(void)
add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace, 0);
add_to_sclist(MWHEREIS|MGOTOLINE, "^T", 0, flip_goto, 0);
#ifdef ENABLE_HISTORIES
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^P", 0, get_history_older_void, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^N", 0, get_history_newer_void, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^P", 0, get_older_item, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^N", 0, get_newer_item, 0);
#ifdef ENABLE_UTF8
if (using_utf8()) {
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "\xE2\x96\xb4", KEY_UP, get_history_older_void, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "\xE2\x96\xbe", KEY_DOWN, get_history_newer_void, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "\xE2\x96\xb4", KEY_UP, get_older_item, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "\xE2\x96\xbe", KEY_DOWN, get_newer_item, 0);
} else
#endif
{
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "Up", KEY_UP, get_history_older_void, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "Down", KEY_DOWN, get_history_newer_void, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "Up", KEY_UP, get_older_item, 0);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "Down", KEY_DOWN, get_newer_item, 0);
}
#endif
#ifdef ENABLE_JUSTIFY

View File

@ -145,14 +145,6 @@ void update_history(linestruct **item, const char *text)
*item = *hbot;
}
/* Two empty placeholder functions. */
void get_history_older_void(void)
{
}
void get_history_newer_void(void)
{
}
#ifdef ENABLE_TABCOMP
/* Go backward through one of three history lists, starting at its item h,
* searching for a string that is a tab completion of the given string s,

View File

@ -304,8 +304,8 @@ int do_statusbar_input(bool *finished)
if (shortcut->func == do_tab || shortcut->func == do_enter)
;
#ifdef ENABLE_HISTORIES
else if (shortcut->func == get_history_older_void ||
shortcut->func == get_history_newer_void)
else if (shortcut->func == get_older_item ||
shortcut->func == get_newer_item)
;
#endif
else if (shortcut->func == do_left)
@ -504,7 +504,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
} else
#endif /* ENABLE_TABCOMP */
#ifdef ENABLE_HISTORIES
if (func == get_history_older_void) {
if (func == get_older_item) {
if (history_list != NULL) {
/* If we're scrolling up at the bottom of the history list
* and answer isn't blank, save answer in magichistory. */
@ -519,7 +519,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
typing_x = strlen(answer);
}
}
} else if (func == get_history_newer_void) {
} else if (func == get_newer_item) {
if (history_list != NULL) {
/* Get the newer search from the history list and save it in
* answer. If there is no newer search, don't do anything. */

View File

@ -336,8 +336,6 @@ void do_help(void);
void history_init(void);
void history_reset(const linestruct *list);
void update_history(linestruct **item, const char *text);
void get_history_older_void(void);
void get_history_newer_void(void);
#ifdef ENABLE_TABCOMP
char *get_history_completion(linestruct **h, char *s, size_t len);
#endif
@ -632,6 +630,10 @@ void do_credits(void);
void case_sens_void(void);
void regexp_void(void);
void backwards_void(void);
#ifdef ENABLE_HISTORIES
void get_older_item(void);
void get_newer_item(void);
#endif
void flip_replace(void);
void flip_goto(void);
#ifdef ENABLE_BROWSER

View File

@ -409,9 +409,9 @@ keystruct *strtosc(const char *input)
s->func = flip_goto;
#ifdef ENABLE_HISTORIES
else if (!strcmp(input, "older"))
s->func = get_history_older_void;
s->func = get_older_item;
else if (!strcmp(input, "newer"))
s->func = get_history_newer_void;
s->func = get_newer_item;
#endif
#ifndef NANO_TINY
else if (!strcmp(input, "dosformat"))