nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] bindings: allow toggling the help lines at several prompts and i


From: Benno Schulenberg
Subject: [PATCH] bindings: allow toggling the help lines at several prompts and in browser
Date: Mon, 15 Jun 2020 09:24:11 +0200

Now the help lines can be toggled not only while editing, but also at
the Read (^R), Write (^O), Execute (^T), Search (^W), Replace (M-R),
Goto (^/), and Yesno prompts, and also in the file browser and when
searching for a file name.  The help lines cannot be toggled in the
help viewer, nor when searching in a help text, nor in the linter,
as these three things force the help lines to be on.

furthermore, the 'nohelp' function can be rebound in all relevant
menus (default binding: M-X).

This fulfills https://savannah.gnu.org/bugs/?58471.
---
 src/browser.c |  6 ++++++
 src/global.c  |  2 +-
 src/prompt.c  | 17 +++++++++++++++++
 src/rcfile.c  |  4 +++-
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/browser.c b/src/browser.c
index 5c6c9c98..07c141a2 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -168,6 +168,12 @@ char *do_browser(char *path)
 #endif
 #else
                        say_there_is_no_help();
+#endif
+#ifndef NANO_TINY
+               } else if (func == do_toggle_void) {
+                       TOGGLE(NO_HELP);
+                       window_init();
+                       kbinput = KEY_WINCH;
 #endif
                } else if (func == do_search_forward) {
                        do_filesearch(FORWARD);
diff --git a/src/global.c b/src/global.c
index 14dda3de..d170d7d5 100644
--- a/src/global.c
+++ b/src/global.c
@@ -1345,7 +1345,7 @@ void shortcut_init(void)
 
 #ifndef NANO_TINY
        /* Group of "Appearance" toggles. */
-       add_to_sclist(MMAIN, "M-X", 0, do_toggle_void, NO_HELP);
+       add_to_sclist((MMOST|MBROWSER|MYESNO) & ~MFINDINHELP, "M-X", 0, 
do_toggle_void, NO_HELP);
        add_to_sclist(MMAIN, "M-C", 0, do_toggle_void, CONSTANT_SHOW);
        add_to_sclist(MMAIN, "M-S", 0, do_toggle_void, SOFTWRAP);
        add_to_sclist(MMAIN, "M-$", 0, do_toggle_void, SOFTWRAP);
diff --git a/src/prompt.c b/src/prompt.c
index 11b92df9..d7981444 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -515,6 +515,14 @@ functionptrtype acquire_an_answer(int *actual, bool 
allow_tabs,
 #ifndef NANO_TINY
                else if (func == do_nothing)
                        finished = FALSE;
+               else if (func == do_toggle_void) {
+                       TOGGLE(NO_HELP);
+                       window_init();
+                       focusing = FALSE;
+                       refresh_func();
+                       bottombars(currmenu);
+                       finished = FALSE;
+               }
 #endif
 
                /* If we have a shortcut with an associated function, break out 
if
@@ -741,6 +749,15 @@ int do_yesno_prompt(bool all, const char *msg)
 #endif /* ENABLE_MOUSE */
                else if (func_from_key(&kbinput) == full_refresh)
                        full_refresh();
+#ifndef NANO_TINY
+               else if (func_from_key(&kbinput) == do_toggle_void) {
+                       TOGGLE(NO_HELP);
+                       window_init();
+                       titlebar(NULL);
+                       focusing = FALSE;
+                       edit_refresh();
+               }
+#endif
                else
                        beep();
 
diff --git a/src/rcfile.c b/src/rcfile.c
index 109e9a16..14cf64e7 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -814,10 +814,12 @@ void parse_binding(char *ptr, bool dobind)
                goto free_things;
 
        /* Limit the given menu to those where the function exists;
-        * first handle four special cases, then the general case. */
+        * first handle five special cases, then the general case. */
        if (is_universal(newsc->func))
                menu &= MMOST|MBROWSER;
 #ifndef NANO_TINY
+       else if (newsc->func == do_toggle_void && newsc->toggle == NO_HELP)
+               menu &= (MMOST|MBROWSER|MYESNO) & ~MFINDINHELP;
        else if (newsc->func == do_toggle_void)
                menu &= MMAIN;
 #endif
-- 
2.25.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]