From e21e9547420012f339292571e50e91063a39f717 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Mon, 2 May 2016 09:34:23 +0200
Subject: [PATCH] browser: add a binding for the refresh function

And make the function actually refresh the list.  Useful for when files
have been added or deleted since opening the browser.
---
 src/browser.c | 2 ++
 src/global.c  | 9 +++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/browser.c b/src/browser.c
index 342c29ac..e688e4d6 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -174,6 +174,8 @@ char *do_browser(char *path, DIR *dir)
 
 	if (func == total_refresh) {
 	    total_redraw();
+	    /* Simulate a window resize. */
+	    kbinput = KEY_WINCH;
 	} else if (func == do_help_void) {
 #ifndef DISABLE_HELP
 	    do_help_void();
diff --git a/src/global.c b/src/global.c
index 999595e0..c284c443 100644
--- a/src/global.c
+++ b/src/global.c
@@ -527,8 +527,8 @@ void shortcut_init(void)
     const char *nano_whereis_msg =
 	N_("Search for a string or a regular expression");
 #ifndef DISABLE_BROWSER
-    const char *nano_browser_whereis_msg =
-	N_("Search for a string");
+    const char *nano_browser_whereis_msg = N_("Search for a string");
+    const char *nano_browser_refresh_msg = N_("Refresh the file list");
 #endif
     const char *nano_prevpage_msg = N_("Go one screenful up");
     const char *nano_nextpage_msg = N_("Go one screenful down");
@@ -1013,6 +1013,10 @@ void shortcut_init(void)
     add_to_funcs(do_research, MBROWSER,
 	whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW);
 #endif
+#ifndef DISABLE_BROWSER
+    add_to_funcs(total_refresh, MBROWSER,
+	refresh_tag, IFSCHELP(nano_browser_refresh_msg), BLANKAFTER, VIEW);
+#endif
 
 #ifndef DISABLE_COLOR
     add_to_funcs(do_page_up, MLINTER,
@@ -1199,6 +1203,7 @@ void shortcut_init(void)
     add_to_sclist(MBROWSER, "^_", goto_dir_void, 0);
     add_to_sclist(MBROWSER, "M-G", goto_dir_void, 0);
     add_to_sclist(MBROWSER, "F13", goto_dir_void, 0);
+    add_to_sclist(MBROWSER, "^L", total_refresh, 0);
 #endif
     if (ISSET(TEMP_FILE))
 	add_to_sclist(MWRITEFILE, "^Q", discard_buffer, 0);
-- 
GitLab