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.
This commit is contained in:
Benno Schulenberg 2016-04-17 18:09:24 +02:00
parent eb2661dc2d
commit 36ec76a508
3 changed files with 8 additions and 14 deletions

View File

@ -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 */

View File

@ -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

View File

@ -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