From de4fbadf2008f6360b82531920a5ae19e241a321 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 1 Mar 2018 11:08:13 +0100
Subject: [PATCH] tweaks: reshuffle some code, to be slightly less ugly

---
 src/rcfile.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/rcfile.c b/src/rcfile.c
index 677f4162..bde77b4d 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -336,9 +336,6 @@ bool is_universal(void (*func)(void))
 		func == do_home || func == do_end ||
 #ifndef NANO_TINY
 		func == do_prev_word_void || func == do_next_word_void ||
-#endif
-#ifdef ENABLE_NANORC
-		func == (void *)implant ||
 #endif
 		func == do_delete || func == do_backspace ||
 		func == do_cut_text_void || func == do_uncut_text ||
@@ -455,12 +452,13 @@ void parse_binding(char *ptr, bool dobind)
 		if (newsc->func == do_toggle_void)
 			mask = MMAIN;
 #endif
-
+#ifdef ENABLE_NANORC
+		/* Handle the special case of a key defined as a string. */
+		if (newsc->func == (void *)implant)
+			mask = MMOST | MHELP;
+#endif
 		/* Now limit the given menu to those where the function exists. */
-		if (is_universal(newsc->func))
-			menu = menu & (MMOST | (newsc->func == (void *)implant ? MHELP : 0));
-		else
-			menu = menu & mask;
+		menu = menu & (is_universal(newsc->func) ? MMOST : mask);
 
 		if (!menu) {
 			rcfile_error(N_("Function '%s' does not exist in menu '%s'"), funcptr, menuptr);
-- 
GitLab