commit e21e9547420012f339292571e50e91063a39f717
parent e2556274f7c801ef3df9b8fce968e71ed98b7138
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Mon, 2 May 2016 09:34:23 +0200
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.
Diffstat:
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git 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
@@ -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);