nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 757d223064eb8a924ac765b30addc7626fa16c31
parent ea4ba3a150f6f3a0317a263634c343c89ac02b8f
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 10 Feb 2019 20:17:22 +0100

tweaks: don't bother executing two functions that are empty

The get_history_older_void() and get_history_newer_void() functions
are mere names, they don't actually do anything.  So... don't bother
to execute them, so the 'finished' variable doesn't have to be reset
after calling them.

Also, normalize the order of those two empty functions.

Diffstat:
Msrc/history.c | 8+++-----
Msrc/prompt.c | 17+++++------------
2 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/src/history.c b/src/history.c @@ -167,14 +167,12 @@ char *get_history_newer(filestruct **h) return (*h)->data; } -/* More placeholders. */ -void get_history_newer_void(void) +/* Two empty placeholder functions. */ +void get_history_older_void(void) { - ; } -void get_history_older_void(void) +void get_history_newer_void(void) { - ; } #ifdef ENABLE_TABCOMP diff --git a/src/prompt.c b/src/prompt.c @@ -126,6 +126,11 @@ int do_statusbar_input(bool *finished) if (shortcut) { 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) + ; +#endif else if (shortcut->func == do_left) do_statusbar_left(); else if (shortcut->func == do_right) @@ -518,12 +523,6 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs, answer = mallocstrcpy(answer, history); typing_x = strlen(answer); } - - /* This key has a shortcut-list entry when it's used to - * move to an older search, which means that finished has - * been set to TRUE. Set it back to FALSE here, so that - * we aren't kicked out of the statusbar prompt. */ - finished = FALSE; } } else if (func == get_history_newer_void) { if (history_list != NULL) { @@ -541,12 +540,6 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs, answer = mallocstrcpy(answer, magichistory); typing_x = strlen(answer); } - - /* This key has a shortcut-list entry when it's used to - * move to a newer search, which means that finished has - * been set to TRUE. Set it back to FALSE here, so that - * we aren't kicked out of the statusbar prompt. */ - finished = FALSE; } } else #endif /* ENABLE_HISTORIES */