nano

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

commit 36ec76a508f9aee6aeea4bb6195864f31acbeca7
parent eb2661dc2d7325aa656f3631c41ef7772cc5f88b
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Sun, 17 Apr 2016 18:09:24 +0200

tabbing: don't refresh the edit window when nothing was printed on it

This is a remnant from 2001, when things were different.  Now, there
is no need to refresh the edit window when tabbing produced no list.
When it did produce a list, it is cleared off later.

Diffstat:
Msrc/files.c | 11+++--------
Msrc/prompt.c | 7+++----
Msrc/proto.h | 4++--
3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -2770,14 +2770,14 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t /* Do tab completion. place refers to how much the statusbar cursor * position should be advanced. refresh_func is the function we will * call to refresh the edit window. */ -char *input_tab(char *buf, bool allow_files, size_t *place, bool - *lastwastab, void (*refresh_func)(void), bool *listed) +char *input_tab(char *buf, bool allow_files, size_t *place, + bool *lastwastab, bool *listed) { size_t num_matches = 0, buf_len; char **matches = NULL; assert(buf != NULL && place != NULL && *place <= strlen(buf) && - lastwastab != NULL && refresh_func != NULL && listed != NULL); + lastwastab != NULL && listed != NULL); *listed = FALSE; @@ -2923,11 +2923,6 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool free_chararray(matches, num_matches); - /* Only refresh the edit window if we don't have a list of filename - * matches on it. */ - if (!*listed) - refresh_func(); - return buf; } #endif /* !DISABLE_TABCOMP */ diff --git a/src/prompt.c b/src/prompt.c @@ -619,7 +619,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs, #endif if (allow_tabs) answer = input_tab(answer, allow_files, &statusbar_x, - &tabbed, refresh_func, listed); + &tabbed, listed); update_the_statusbar(); } else @@ -786,9 +786,8 @@ int do_prompt(bool allow_tabs, #endif #ifndef DISABLE_TABCOMP - /* If we've done tab completion, there might be a list of filename - * matches on the edit window at this point. Make sure that they're - * cleared off. */ + /* If we've done tab completion, and a list of filename matches + * was printed in the edit window, clear them off. */ if (listed) refresh_func(); #endif diff --git a/src/proto.h b/src/proto.h @@ -339,8 +339,8 @@ char **username_tab_completion(const char *buf, size_t *num_matches, size_t buf_len); char **cwd_tab_completion(const char *buf, bool allow_files, size_t *num_matches, size_t buf_len); -char *input_tab(char *buf, bool allow_files, size_t *place, bool - *lastwastab, void (*refresh_func)(void), bool *listed); +char *input_tab(char *buf, bool allow_files, size_t *place, + bool *lastwastab, bool *listed); #endif const char *tail(const char *foo); #ifndef DISABLE_HISTORIES