From 36ec76a508f9aee6aeea4bb6195864f31acbeca7 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@justemail.net> Date: Sun, 17 Apr 2016 18:09:24 +0200 Subject: [PATCH] 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. --- src/files.c | 11 +++-------- src/prompt.c | 7 +++---- src/proto.h | 4 ++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/files.c b/src/files.c index 38fdb1b8..d3945f84 100644 --- 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 index 92d2c868..e621bc63 100644 --- 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 index 91a714c1..44621a40 100644 --- 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 -- GitLab