mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 21:01:24 +03:00
bindings: allow toggling the help lines at several prompts and in browser
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.
This commit is contained in:
parent
054cafa138
commit
d8249917c3
@ -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);
|
||||
|
@ -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);
|
||||
|
17
src/prompt.c
17
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();
|
||||
|
||||
|
@ -816,10 +816,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
|
||||
|
Loading…
Reference in New Issue
Block a user