Commit 50616148 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

prompt: recompose the statusbar text whenever the window size changes

This fixes https://savannah.gnu.org/bugs/?48796.
parent 3e40e5d4
Showing with 7 additions and 3 deletions
+7 -3
...@@ -563,10 +563,12 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs, ...@@ -563,10 +563,12 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
assert(statusbar_x <= strlen(answer)); assert(statusbar_x <= strlen(answer));
#ifndef NANO_TINY #ifndef NANO_TINY
/* If the window size changed, go reformat the prompt string. */
if (kbinput == KEY_WINCH) { if (kbinput == KEY_WINCH) {
refresh_func(); refresh_func();
update_the_statusbar(); *actual = KEY_WINCH;
continue; free(magichistory);
return NULL;
} }
#endif #endif
func = func_from_key(&kbinput); func = func_from_key(&kbinput);
...@@ -706,7 +708,7 @@ int do_prompt(bool allow_tabs, ...@@ -706,7 +708,7 @@ int do_prompt(bool allow_tabs,
void (*refresh_func)(void), const char *msg, ...) void (*refresh_func)(void), const char *msg, ...)
{ {
va_list ap; va_list ap;
int retval; int retval = KEY_WINCH;
functionptrtype func; functionptrtype func;
#ifndef DISABLE_TABCOMP #ifndef DISABLE_TABCOMP
bool listed = FALSE; bool listed = FALSE;
...@@ -717,6 +719,7 @@ int do_prompt(bool allow_tabs, ...@@ -717,6 +719,7 @@ int do_prompt(bool allow_tabs,
bottombars(menu); bottombars(menu);
while (retval == KEY_WINCH) {
prompt = charalloc((COLS * mb_cur_max()) + 1); prompt = charalloc((COLS * mb_cur_max()) + 1);
va_start(ap, msg); va_start(ap, msg);
vsnprintf(prompt, COLS * mb_cur_max(), msg, ap); vsnprintf(prompt, COLS * mb_cur_max(), msg, ap);
...@@ -735,6 +738,7 @@ int do_prompt(bool allow_tabs, ...@@ -735,6 +738,7 @@ int do_prompt(bool allow_tabs,
free(prompt); free(prompt);
prompt = NULL; prompt = NULL;
}
/* If we're done with this prompt, restore the x position to what /* If we're done with this prompt, restore the x position to what
* it was at a possible previous prompt. */ * it was at a possible previous prompt. */
......
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