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

tweaks: elide a bit of code duplication

parent 8b636de1
Showing with 6 additions and 10 deletions
+6 -10
...@@ -129,17 +129,13 @@ char *do_browser(char *path) ...@@ -129,17 +129,13 @@ char *do_browser(char *path)
bottombars(MBROWSER); bottombars(MBROWSER);
#ifndef NANO_TINY #ifndef NANO_TINY
/* If the window resized, also refresh the file list. */
if (kbinput == KEY_WINCH) { if (kbinput == KEY_WINCH) {
/* Remember the selected file, to be able to reselect it. */ /* Remember the selected file, to be able to reselect it. */
present_name = strdup(filelist[selected]); present_name = strdup(filelist[selected]);
/* Reread the contents of the current directory. */
/* Reopen the current directory. */ newpath = strdup(present_path);
dir = opendir(path); goto read_directory_contents;
if (dir != NULL)
goto read_directory_contents;
statusline(ALERT, _("Error reading %s: %s"), path, strerror(errno));
kbinput = ERR;
} }
#endif #endif
/* Display (or redisplay) the file list if we don't have a key yet, /* Display (or redisplay) the file list if we don't have a key yet,
...@@ -191,15 +187,15 @@ char *do_browser(char *path) ...@@ -191,15 +187,15 @@ char *do_browser(char *path)
if (func == total_refresh) { if (func == total_refresh) {
total_redraw(); total_redraw();
/* Simulate a window resize to force a directory reread. */
#ifndef NANO_TINY #ifndef NANO_TINY
/* Simulate a window resize to force a directory reread. */
kbinput = KEY_WINCH; kbinput = KEY_WINCH;
#endif #endif
} else if (func == do_help_void) { } else if (func == do_help_void) {
#ifndef DISABLE_HELP #ifndef DISABLE_HELP
do_help_void(); do_help_void();
/* The window dimensions might have changed, so act as if. */
#ifndef NANO_TINY #ifndef NANO_TINY
/* The window dimensions might have changed, so act as if. */
kbinput = KEY_WINCH; kbinput = KEY_WINCH;
#endif #endif
#else #else
......
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