diff --git a/src/browser.c b/src/browser.c index 9bcecfa..7c42419 100644 --- a/src/browser.c +++ b/src/browser.c @@ -131,20 +131,6 @@ char *do_browser(char *path) bottombars(MBROWSER); -#ifndef NANO_TINY - if (kbinput == KEY_WINCH) { - /* Remember the selected file, to be able to reselect it. */ - present_name = strdup(filelist[selected]); - - /* Reopen the current directory. */ - dir = opendir(path); - if (dir != NULL) - goto read_directory_contents; - - statusline(ALERT, _("Error reading %s: %s"), path, strerror(errno)); - kbinput = ERR; - } -#endif /* Display (or redisplay) the file list if we don't have a key yet, * or the list has changed, or the selected file has changed. */ if (kbinput == ERR || old_selected != selected) @@ -156,7 +142,7 @@ char *do_browser(char *path) #ifndef NANO_TINY if (kbinput == KEY_WINCH) - continue; + goto read_directory_contents; #endif #ifndef DISABLE_MOUSE @@ -194,16 +180,28 @@ char *do_browser(char *path) if (func == total_refresh) { total_redraw(); - /* Simulate a window resize to force a directory reread. */ #ifndef NANO_TINY - kbinput = KEY_WINCH; + /* Remember the selected file, to be able to reselect it. */ + if (present_name != NULL) + free(present_name); + present_name = strdup(filelist[selected]); + + /* Try opening and reading the current working directory. */ + newpath = strdup(present_path); + goto read_directory_contents; #endif } else if (func == do_help_void) { #ifndef DISABLE_HELP do_help_void(); - /* The window dimensions might have changed, so act as if. */ #ifndef NANO_TINY - kbinput = KEY_WINCH; + /* Remember the selected file, to be able to reselect it. */ + if (present_name != NULL) + free(present_name); + present_name = strdup(filelist[selected]); + + /* Try opening and reading the current working directory. */ + newpath = strdup(present_path); + goto read_directory_contents; #endif #else say_there_is_no_help();