nano-devel
[Top][All Lists]
Advanced

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

[PATCH V2] bindings: make Refresh (^L) work at all the prompts again


From: Benno Schulenberg
Subject: [PATCH V2] bindings: make Refresh (^L) work at all the prompts again
Date: Mon, 1 Jun 2020 11:48:50 +0200

  V2: The Refresh function is now also rebindable everywhere.

This fixes https://savannah.gnu.org/bugs/?58469.

Bug existed since around version 2.1.0.

(Unfortunately, this means that ^L cannot be used for the Linter
in the "Execute Command" menu.)
---
 src/global.c |  6 +++---
 src/prompt.c | 11 ++++-------
 src/rcfile.c |  4 +++-
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/global.c b/src/global.c
index 6edeacde..86fb791a 100644
--- a/src/global.c
+++ b/src/global.c
@@ -1190,7 +1190,7 @@ void shortcut_init(void)
 #endif
 #ifdef ENABLE_COLOR
        add_to_sclist(MMAIN, "M-B", 0, do_linter, 0);
-       add_to_sclist(MEXECUTE, "^L", 0, do_linter, 0);
+       add_to_sclist(MEXECUTE, "^Y", 0, do_linter, 0);
        add_to_sclist(MMAIN, "M-F", 0, do_formatter, 0);
        add_to_sclist(MEXECUTE, "^O", 0, do_formatter, 0);
 #endif
@@ -1336,9 +1336,9 @@ void shortcut_init(void)
        add_to_sclist(MEXECUTE, "^J", 0, do_full_justify, 0);
 #endif
        if (!ISSET(PRESERVE))
-               add_to_sclist(MMAIN|MBROWSER|MHELP, "^L", 0, full_refresh, 0);
+               add_to_sclist(MMOST|MBROWSER|MHELP|MYESNO, "^L", 0, 
full_refresh, 0);
        else
-               add_to_sclist(MMAIN|MBROWSER, "^L", 0, full_refresh, 0);
+               add_to_sclist(MMOST|MBROWSER|MYESNO, "^L", 0, full_refresh, 0);
        add_to_sclist(MMAIN|MEXECUTE, "^Z", 0, do_suspend_void, 0);
 
 #ifndef NANO_TINY
diff --git a/src/prompt.c b/src/prompt.c
index f66da1c8..11b92df9 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -509,14 +509,9 @@ functionptrtype acquire_an_answer(int *actual, bool 
allow_tabs,
                        }
                } else
 #endif /* ENABLE_HISTORIES */
-               if (func == do_help) {
-                       /* This key has a shortcut-list entry when it's used to 
go to
-                        * the help viewer or display a message indicating that 
help
-                        * is disabled, which means that finished has been set 
to TRUE.
-                        * Set it back to FALSE here, so that we aren't kicked 
out of
-                        * the status-bar prompt. */
+               /* If we ran a function that should not exit from the prompt... 
*/
+               if (func == do_help || func == full_refresh)
                        finished = FALSE;
-               }
 #ifndef NANO_TINY
                else if (func == do_nothing)
                        finished = FALSE;
@@ -744,6 +739,8 @@ int do_yesno_prompt(bool all, const char *msg)
                        }
                }
 #endif /* ENABLE_MOUSE */
+               else if (func_from_key(&kbinput) == full_refresh)
+                       full_refresh();
                else
                        beep();
 
diff --git a/src/rcfile.c b/src/rcfile.c
index c76f2cc5..479ae70c 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -813,13 +813,15 @@ void parse_binding(char *ptr, bool dobind)
                goto free_things;
 
        /* Limit the given menu to those where the function exists;
-        * first handle three special cases, then the general case. */
+        * first handle four special cases, then the general case. */
        if (is_universal(newsc->func))
                menu &= MMOST|MBROWSER;
 #ifndef NANO_TINY
        else if (newsc->func == do_toggle_void)
                menu &= MMAIN;
 #endif
+       else if (newsc->func == full_refresh)
+               menu &= MMOST|MBROWSER|MHELP|MYESNO;
        else if (newsc->func == (functionptrtype)implant)
                menu &= MMOST|MBROWSER|MHELP;
        else {
-- 
2.25.4




reply via email to

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