Commit 36ec76a5 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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.
No related merge requests found
Showing with 8 additions and 14 deletions
+8 -14
...@@ -2770,14 +2770,14 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t ...@@ -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 /* Do tab completion. place refers to how much the statusbar cursor
* position should be advanced. refresh_func is the function we will * position should be advanced. refresh_func is the function we will
* call to refresh the edit window. */ * call to refresh the edit window. */
char *input_tab(char *buf, bool allow_files, size_t *place, bool char *input_tab(char *buf, bool allow_files, size_t *place,
*lastwastab, void (*refresh_func)(void), bool *listed) bool *lastwastab, bool *listed)
{ {
size_t num_matches = 0, buf_len; size_t num_matches = 0, buf_len;
char **matches = NULL; char **matches = NULL;
assert(buf != NULL && place != NULL && *place <= strlen(buf) && assert(buf != NULL && place != NULL && *place <= strlen(buf) &&
lastwastab != NULL && refresh_func != NULL && listed != NULL); lastwastab != NULL && listed != NULL);
*listed = FALSE; *listed = FALSE;
...@@ -2923,11 +2923,6 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool ...@@ -2923,11 +2923,6 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
free_chararray(matches, num_matches); 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; return buf;
} }
#endif /* !DISABLE_TABCOMP */ #endif /* !DISABLE_TABCOMP */
......
...@@ -619,7 +619,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs, ...@@ -619,7 +619,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
#endif #endif
if (allow_tabs) if (allow_tabs)
answer = input_tab(answer, allow_files, &statusbar_x, answer = input_tab(answer, allow_files, &statusbar_x,
&tabbed, refresh_func, listed); &tabbed, listed);
update_the_statusbar(); update_the_statusbar();
} else } else
...@@ -786,9 +786,8 @@ int do_prompt(bool allow_tabs, ...@@ -786,9 +786,8 @@ int do_prompt(bool allow_tabs,
#endif #endif
#ifndef DISABLE_TABCOMP #ifndef DISABLE_TABCOMP
/* If we've done tab completion, there might be a list of filename /* If we've done tab completion, and a list of filename matches
* matches on the edit window at this point. Make sure that they're * was printed in the edit window, clear them off. */
* cleared off. */
if (listed) if (listed)
refresh_func(); refresh_func();
#endif #endif
......
...@@ -339,8 +339,8 @@ char **username_tab_completion(const char *buf, size_t *num_matches, ...@@ -339,8 +339,8 @@ char **username_tab_completion(const char *buf, size_t *num_matches,
size_t buf_len); size_t buf_len);
char **cwd_tab_completion(const char *buf, bool allow_files, size_t char **cwd_tab_completion(const char *buf, bool allow_files, size_t
*num_matches, size_t buf_len); *num_matches, size_t buf_len);
char *input_tab(char *buf, bool allow_files, size_t *place, bool char *input_tab(char *buf, bool allow_files, size_t *place,
*lastwastab, void (*refresh_func)(void), bool *listed); bool *lastwastab, bool *listed);
#endif #endif
const char *tail(const char *foo); const char *tail(const char *foo);
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment