mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-26 14:51:36 +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
|
#endif
|
||||||
#else
|
#else
|
||||||
say_there_is_no_help();
|
say_there_is_no_help();
|
||||||
|
#endif
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
} else if (func == do_toggle_void) {
|
||||||
|
TOGGLE(NO_HELP);
|
||||||
|
window_init();
|
||||||
|
kbinput = KEY_WINCH;
|
||||||
#endif
|
#endif
|
||||||
} else if (func == do_search_forward) {
|
} else if (func == do_search_forward) {
|
||||||
do_filesearch(FORWARD);
|
do_filesearch(FORWARD);
|
||||||
|
@ -1345,7 +1345,7 @@ void shortcut_init(void)
|
|||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Group of "Appearance" toggles. */
|
/* 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-C", 0, do_toggle_void, CONSTANT_SHOW);
|
||||||
add_to_sclist(MMAIN, "M-S", 0, do_toggle_void, SOFTWRAP);
|
add_to_sclist(MMAIN, "M-S", 0, do_toggle_void, SOFTWRAP);
|
||||||
add_to_sclist(MMAIN, "M-$", 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
|
#ifndef NANO_TINY
|
||||||
else if (func == do_nothing)
|
else if (func == do_nothing)
|
||||||
finished = FALSE;
|
finished = FALSE;
|
||||||
|
else if (func == do_toggle_void) {
|
||||||
|
TOGGLE(NO_HELP);
|
||||||
|
window_init();
|
||||||
|
focusing = FALSE;
|
||||||
|
refresh_func();
|
||||||
|
bottombars(currmenu);
|
||||||
|
finished = FALSE;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If we have a shortcut with an associated function, break out if
|
/* 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 */
|
#endif /* ENABLE_MOUSE */
|
||||||
else if (func_from_key(&kbinput) == full_refresh)
|
else if (func_from_key(&kbinput) == full_refresh)
|
||||||
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
|
else
|
||||||
beep();
|
beep();
|
||||||
|
|
||||||
|
@ -816,10 +816,12 @@ void parse_binding(char *ptr, bool dobind)
|
|||||||
goto free_things;
|
goto free_things;
|
||||||
|
|
||||||
/* Limit the given menu to those where the function exists;
|
/* 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))
|
if (is_universal(newsc->func))
|
||||||
menu &= MMOST|MBROWSER;
|
menu &= MMOST|MBROWSER;
|
||||||
#ifndef NANO_TINY
|
#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)
|
else if (newsc->func == do_toggle_void)
|
||||||
menu &= MMAIN;
|
menu &= MMAIN;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user