commit d729edaeda5f1bf3de395f5a13865649cd91357a
parent bc92e28b30784657b1b0aa288c034bae54d0afca
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 31 May 2020 19:09:48 +0200
bindings: make ^L (Refresh) work at all the prompts too
(Unfortunately, this means that ^L cannot be used for the
Linter in the "Execute Command" menu.)
This fixes https://savannah.gnu.org/bugs/?58469.
Bug existed since around version 2.1.0.
Diffstat:
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git 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
@@ -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
@@ -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 {