From bdd8920081974d72f71fe421acee5deb7f9d4c1c Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 1 Mar 2018 10:55:04 +0100
Subject: [PATCH] bindings: make a key defined as string work also in browser
 and viewer

---
 src/browser.c | 4 ++++
 src/help.c    | 4 ++++
 src/rcfile.c  | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/browser.c b/src/browser.c
index fda71298..bae5c96b 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -303,6 +303,10 @@ char *do_browser(char *path)
 			/* Try opening and reading the selected directory. */
 			path = mallocstrcpy(path, filelist[selected]);
 			goto read_directory_contents;
+#ifdef ENABLE_NANORC
+		} else if (func == (void *)implant) {
+			implant(first_sc_for(MBROWSER, func)->expansion);
+#endif
 		} else if (func == do_exit) {
 			/* Exit from the file browser. */
 			break;
diff --git a/src/help.c b/src/help.c
index 3067496b..5bae93ee 100644
--- a/src/help.c
+++ b/src/help.c
@@ -215,6 +215,10 @@ void do_help(void)
 			do_findprevious();
 		} else if (func == do_findnext) {
 			do_findnext();
+#ifdef ENABLE_NANORC
+		} else if (func == (void *)implant) {
+			implant(first_sc_for(MHELP, func)->expansion);
+#endif
 		} else if (kbinput == KEY_WINCH) {
 			; /* Nothing to do. */
 #endif
diff --git a/src/rcfile.c b/src/rcfile.c
index 362f3c8e..677f4162 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -458,7 +458,7 @@ void parse_binding(char *ptr, bool dobind)
 
 		/* Now limit the given menu to those where the function exists. */
 		if (is_universal(newsc->func))
-			menu = menu & MMOST;
+			menu = menu & (MMOST | (newsc->func == (void *)implant ? MHELP : 0));
 		else
 			menu = menu & mask;
 
-- 
GitLab