bindings: make ^Q and M-Q available also in the help viewer

As the help viewer is almost a normal buffer, commands that make sense
-- like searching backwards, and searching the previous occurrence --
should work in the help viewer too.

In addition, show all Search commands prominently in the help lines of
the help viewer, so that users are likely to notice them and will maybe
infer that they work in the editor itself too.

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

With-help-from: David Lawrence Ramsey <pooka109@gmail.com>
master
Benno Schulenberg 2018-07-27 20:07:15 +02:00
parent 7e18b91ead
commit 7f2031006a
3 changed files with 12 additions and 17 deletions

View File

@ -169,12 +169,10 @@ char *do_browser(char *path)
do_filesearch(); do_filesearch();
} else if (func == do_research) { } else if (func == do_research) {
do_fileresearch(FORWARD); do_fileresearch(FORWARD);
#ifndef NANO_TINY
} else if (func == do_findprevious) { } else if (func == do_findprevious) {
do_fileresearch(BACKWARD); do_fileresearch(BACKWARD);
} else if (func == do_findnext) { } else if (func == do_findnext) {
do_fileresearch(FORWARD); do_fileresearch(FORWARD);
#endif
} else if (func == do_left) { } else if (func == do_left) {
if (selected > 0) if (selected > 0)
selected--; selected--;

View File

@ -758,7 +758,6 @@ void shortcut_init(void)
add_to_funcs(do_exit, MHELP, close_tag, "x", 0, VIEW); add_to_funcs(do_exit, MHELP, close_tag, "x", 0, VIEW);
add_to_funcs(do_search_forward, MHELP, whereis_tag, "x", 0, VIEW); add_to_funcs(do_search_forward, MHELP, whereis_tag, "x", 0, VIEW);
add_to_funcs(do_research, MHELP, whereisnext_tag, "x", 0, VIEW);
#endif #endif
add_to_funcs(do_cut_text_void, MMAIN, add_to_funcs(do_cut_text_void, MMAIN,
@ -842,12 +841,12 @@ void shortcut_init(void)
N_("Save"), WITHORSANS(savefile_gist), BLANKAFTER, NOVIEW); N_("Save"), WITHORSANS(savefile_gist), BLANKAFTER, NOVIEW);
#endif #endif
add_to_funcs(do_search_backward, MMAIN, add_to_funcs(do_search_backward, MMAIN|MHELP|MBROWSER,
/* TRANSLATORS: This starts a backward search. */ /* TRANSLATORS: This starts a backward search. */
N_("Where Was"), WITHORSANS(wherewas_gist), TOGETHER, VIEW); N_("Where Was"), WITHORSANS(wherewas_gist), TOGETHER, VIEW);
add_to_funcs(do_findprevious, MMAIN, add_to_funcs(do_findprevious, MMAIN|MHELP|MBROWSER,
N_("Previous"), WITHORSANS(findprev_gist), TOGETHER, VIEW); N_("Previous"), WITHORSANS(findprev_gist), TOGETHER, VIEW);
add_to_funcs(do_findnext, MMAIN, add_to_funcs(do_findnext, MMAIN|MHELP|MBROWSER,
N_("Next"), WITHORSANS(findnext_gist), BLANKAFTER, VIEW); N_("Next"), WITHORSANS(findnext_gist), BLANKAFTER, VIEW);
add_to_funcs(do_left, MMAIN, add_to_funcs(do_left, MMAIN,
@ -1099,7 +1098,7 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "^R", 0, do_insertfile_void, 0); add_to_sclist(MMAIN, "^R", 0, do_insertfile_void, 0);
add_to_sclist(MMAIN, "F5", 0, do_insertfile_void, 0); add_to_sclist(MMAIN, "F5", 0, do_insertfile_void, 0);
add_to_sclist(MMAIN, "Ins", 0, do_insertfile_void, 0); add_to_sclist(MMAIN, "Ins", 0, do_insertfile_void, 0);
add_to_sclist(MMAIN, "^Q", 0, do_search_backward, 0); add_to_sclist(MMAIN|MHELP|MBROWSER, "^Q", 0, do_search_backward, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^W", 0, do_search_forward, 0); add_to_sclist(MMAIN|MHELP|MBROWSER, "^W", 0, do_search_forward, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "F6", 0, do_search_forward, 0); add_to_sclist(MMAIN|MHELP|MBROWSER, "F6", 0, do_search_forward, 0);
add_to_sclist(MMAIN, "^\\", 0, do_replace, 0); add_to_sclist(MMAIN, "^\\", 0, do_replace, 0);
@ -1140,10 +1139,9 @@ void shortcut_init(void)
add_to_sclist(MMAIN|MHELP, "M-/", 0, to_last_line, 0); add_to_sclist(MMAIN|MHELP, "M-/", 0, to_last_line, 0);
add_to_sclist(MMAIN|MHELP, "^End", CONTROL_END, to_last_line, 0); add_to_sclist(MMAIN|MHELP, "^End", CONTROL_END, to_last_line, 0);
add_to_sclist(MMAIN|MHELP, "M-?", 0, to_last_line, 0); add_to_sclist(MMAIN|MHELP, "M-?", 0, to_last_line, 0);
add_to_sclist(MMAIN, "M-W", 0, do_findnext, 0); add_to_sclist(MMAIN|MHELP|MBROWSER, "M-W", 0, do_findnext, 0);
add_to_sclist(MMAIN, "M-Q", 0, do_findprevious, 0); add_to_sclist(MMAIN|MHELP|MBROWSER, "M-Q", 0, do_findprevious, 0);
add_to_sclist(MHELP|MBROWSER, "M-W", 0, do_research, 0); add_to_sclist(MMAIN, "F16", 0, do_research, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "F16", 0, do_research, 0);
#ifndef NANO_TINY #ifndef NANO_TINY
add_to_sclist(MMAIN, "M-]", 0, do_find_bracket, 0); add_to_sclist(MMAIN, "M-]", 0, do_find_bracket, 0);
add_to_sclist(MMAIN, "M-A", 0, do_mark, 0); add_to_sclist(MMAIN, "M-A", 0, do_mark, 0);
@ -1489,12 +1487,10 @@ sc *strtosc(const char *input)
s->func = do_search_backward; s->func = do_search_backward;
else if (!strcasecmp(input, "searchagain")) else if (!strcasecmp(input, "searchagain"))
s->func = do_research; s->func = do_research;
#ifndef NANO_TINY
else if (!strcasecmp(input, "findprevious")) else if (!strcasecmp(input, "findprevious"))
s->func = do_findprevious; s->func = do_findprevious;
else if (!strcasecmp(input, "findnext")) else if (!strcasecmp(input, "findnext"))
s->func = do_findnext; s->func = do_findnext;
#endif
else if (!strcasecmp(input, "replace")) else if (!strcasecmp(input, "replace"))
s->func = do_replace; s->func = do_replace;
else if (!strcasecmp(input, "cut")) else if (!strcasecmp(input, "cut"))

View File

@ -206,11 +206,11 @@ void do_help(void)
} else if (func == to_last_line) { } else if (func == to_last_line) {
to_last_line(); to_last_line();
} else if (func == do_search_forward) { } else if (func == do_search_forward) {
do_search(); do_search_forward();
bottombars(MHELP);
} else if (func == do_search_backward) {
do_search_backward();
bottombars(MHELP); bottombars(MHELP);
} else if (func == do_research) {
do_research();
#ifndef NANO_TINY
} else if (func == do_findprevious) { } else if (func == do_findprevious) {
do_findprevious(); do_findprevious();
} else if (func == do_findnext) { } else if (func == do_findnext) {
@ -219,6 +219,7 @@ void do_help(void)
} else if (func == (functionptrtype)implant) { } else if (func == (functionptrtype)implant) {
implant(first_sc_for(MHELP, func)->expansion); implant(first_sc_for(MHELP, func)->expansion);
#endif #endif
#ifndef NANO_TINY
} else if (kbinput == KEY_WINCH) { } else if (kbinput == KEY_WINCH) {
; /* Nothing to do. */ ; /* Nothing to do. */
#endif #endif