Commit 30f3c533 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

tabbing: refresh the window also when Goto-Dir in browser was cancelled

This restores things to the way they were before commit 36ec76a5.
Apparently all those refreshes are needed in some cases after all.
parent 133ed4e2
No related merge requests found
Showing with 23 additions and 13 deletions
+23 -13
......@@ -2755,14 +2755,15 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t
* 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 *lastwastab, void (*refresh_func)(void), bool *listed)
{
size_t num_matches = 0, buf_len;
char **matches = NULL;
bool listed = FALSE;
assert(buf != NULL && place != NULL && *place <= strlen(buf) &&
lastwastab != NULL && refresh_func != NULL);
lastwastab != NULL && refresh_func != NULL && listed != NULL);
*listed = FALSE;
/* If the word starts with `~' and there is no slash in the word,
* then try completing this word as a username. */
......@@ -2888,8 +2889,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
}
wnoutrefresh(edit);
refresh_needed = TRUE;
listed = TRUE;
*listed = TRUE;
}
free(mzero);
......@@ -2897,8 +2897,9 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
free_chararray(matches, num_matches);
/* Refresh the edit window just in case a previous tab showed a list. */
if (!listed)
/* 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;
......
......@@ -529,7 +529,7 @@ void update_bar_if_needed(void)
/* Get a string of input at the statusbar prompt. */
functionptrtype get_prompt_string(int *actual, bool allow_tabs,
#ifndef DISABLE_TABCOMP
bool allow_files,
bool allow_files, bool *listed,
#endif
const char *curranswer,
#ifndef DISABLE_HISTORIES
......@@ -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);
&tabbed, refresh_func, listed);
update_the_statusbar();
} else
......@@ -735,7 +735,9 @@ int do_prompt(bool allow_tabs,
va_list ap;
int retval;
functionptrtype func;
#ifndef DISABLE_TABCOMP
bool listed = FALSE;
#endif
/* Save a possible current statusbar x position. */
size_t was_statusbar_x = statusbar_x;
size_t was_pww = statusbar_pww;
......@@ -751,7 +753,7 @@ int do_prompt(bool allow_tabs,
func = get_prompt_string(&retval, allow_tabs,
#ifndef DISABLE_TABCOMP
allow_files,
allow_files, &listed,
#endif
curranswer,
#ifndef DISABLE_HISTORIES
......@@ -783,6 +785,13 @@ int do_prompt(bool allow_tabs,
fprintf(stderr, "answer = \"%s\"\n", answer);
#endif
#ifndef DISABLE_TABCOMP
/* If we've done tab completion, there might still be a list of
* filename matches on the edit window. Clear them off. */
if (listed)
refresh_func();
#endif
return retval;
}
......
......@@ -340,7 +340,7 @@ char **username_tab_completion(const char *buf, size_t *num_matches,
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 *lastwastab, void (*refresh_func)(void), bool *listed);
#endif
const char *tail(const char *path);
#ifndef DISABLE_HISTORIES
......@@ -532,7 +532,7 @@ void update_the_statusbar(void);
void update_bar_if_needed(void);
functionptrtype get_prompt_string(int *value, bool allow_tabs,
#ifndef DISABLE_TABCOMP
bool allow_files,
bool allow_files, bool *listed,
#endif
const char *curranswer,
#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