tweaks: avoid an unnecessary refresh for zero or just one completion
parent
ff11ab6b66
commit
0f843b007a
13
src/files.c
13
src/files.c
|
@ -2483,8 +2483,6 @@ char *input_tab(char *buf, size_t *place, void (*refresh_func)(void), bool *list
|
|||
size_t num_matches = 0;
|
||||
char **matches = NULL;
|
||||
|
||||
*listed = FALSE;
|
||||
|
||||
/* If the cursor is not at the end of the fragment, do nothing. */
|
||||
if (buf[*place] != '\0') {
|
||||
beep();
|
||||
|
@ -2501,6 +2499,12 @@ char *input_tab(char *buf, size_t *place, void (*refresh_func)(void), bool *list
|
|||
if (matches == NULL)
|
||||
matches = filename_completion(buf, *place, &num_matches);
|
||||
|
||||
/* If possible completions were listed before but none will be listed now... */
|
||||
if (*listed && num_matches < 2) {
|
||||
refresh_func();
|
||||
*listed = FALSE;
|
||||
}
|
||||
|
||||
if (num_matches == 0)
|
||||
beep();
|
||||
else {
|
||||
|
@ -2607,11 +2611,6 @@ char *input_tab(char *buf, size_t *place, void (*refresh_func)(void), bool *list
|
|||
|
||||
free_chararray(matches, num_matches);
|
||||
|
||||
/* When we didn't list any matches now, refresh the edit window, just
|
||||
* in case a previous tab showed a list, so we know where we are. */
|
||||
if (!*listed)
|
||||
refresh_func();
|
||||
|
||||
return buf;
|
||||
}
|
||||
#endif /* ENABLE_TABCOMP */
|
||||
|
|
|
@ -598,8 +598,7 @@ int do_prompt(int menu, const char *provided, linestruct **history_list,
|
|||
wipe_statusbar();
|
||||
|
||||
#ifdef ENABLE_TABCOMP
|
||||
/* If we've done tab completion, there might still be a list of
|
||||
* filename matches on the edit window. Clear them off. */
|
||||
/* If possible filename completions are still listed, clear them off. */
|
||||
if (listed)
|
||||
refresh_func();
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue