commit 21207b47a048f6ebd58e6c482f2ef303ffb2f2a6
parent 09d574bae9d326282771f293cc300cfdd940c6a1
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 9 Jul 2025 16:07:45 +0200
browser: redo the layout when the window _might_ have resized
The user may have resized the window not only while in the help viewer
but also while at the Search or Goto prompt. Ensure that after all of
them the browser rebuilds the list according to the current dimensions.
This fixes https://savannah.gnu.org/bugs/?67294.
Bug existed since version 2.5.3, commit 813f9f72.
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/browser.c b/src/browser.c
@@ -489,9 +489,6 @@ char *browse(char *path)
if (function == do_help || function == full_refresh) {
function();
#ifndef NANO_TINY
- /* Simulate a terminal resize to force a directory reread,
- * or because the terminal dimensions might have changed. */
- kbinput = THE_WINDOW_RESIZED;
} else if (function == do_toggle && get_shortcut(kbinput)->toggle == NO_HELP) {
TOGGLE(NO_HELP);
window_init();
@@ -556,7 +553,7 @@ char *browse(char *path)
/* TRANSLATORS: This is a prompt. */
browser_refresh, _("Go To Directory")) < 0) {
statusbar(_("Cancelled"));
- continue;
+ goto rearrange;
}
path = free_and_assign(path, real_dir_from_tilde(answer));
@@ -573,7 +570,7 @@ char *browse(char *path)
* the option --operatingdir, not of --restricted. */
statusline(ALERT, _("Can't go outside of %s"), operating_dir);
path = mallocstrcpy(path, present_path);
- continue;
+ goto rearrange;
}
#endif
/* Snip any trailing slashes, so the name can be compared. */
@@ -644,9 +641,11 @@ char *browse(char *path)
} else
unbound_key(kbinput);
+ rearrange:
#ifndef NANO_TINY
/* If the terminal resized (or might have), refresh the file list. */
- if (kbinput == THE_WINDOW_RESIZED) {
+ if (kbinput == THE_WINDOW_RESIZED || function == do_help || function == goto_dir ||
+ function == do_search_backward || function == do_search_forward) {
/* Remember the selected file, to be able to reselect it. */
present_name = copy_of(filelist[selected]);
goto read_directory_contents;