bindings: hard-bind Alt+Up and Alt+Down to findprevious and findnext

So that these functions have bindings by default, and easy bindings.
Add them to the help viewer too, so that searching backward becomes
possible there.
master
Benno Schulenberg 2017-08-13 21:40:02 +02:00
parent 1cc030f7c1
commit 4562401505
4 changed files with 16 additions and 5 deletions

View File

@ -269,11 +269,9 @@
## Key bindings.
## See nanorc(5) (section REBINDING KEYS) for more details on this.
##
## The following five functions are not bound to any key by default.
## The following three functions are not bound to any key by default.
## You may wish to choose different keys than the ones suggested here.
# bind ^S savefile main
# bind M-Q findprevious main
# bind M-W findnext main
# bind M-B cutwordleft main
# bind M-N cutwordright main

View File

@ -1143,6 +1143,11 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "M-\xE2\x86\x90", ALT_LEFT, switch_to_prev_buffer_void, 0);
add_to_sclist(MMAIN, "M-\xE2\x86\x92", ALT_RIGHT, switch_to_next_buffer_void, 0);
#endif
#ifndef NANO_TINY
add_to_sclist(MMAIN|MHELP, "M-\xE2\x86\x91", ALT_UP, do_findprevious, 0);
add_to_sclist(MMAIN|MHELP, "M-\xE2\x86\x93", ALT_DOWN, do_findnext, 0);
#endif
} else
#endif
{

View File

@ -206,7 +206,10 @@ void do_help(void)
} else if (func == do_search) {
do_search();
bottombars(MHELP);
} else if (func == do_research) {
} else if (func == do_findprevious) {
do_findprevious();
currmenu = MHELP;
} else if (func == do_findnext || func == do_research) {
do_research();
currmenu = MHELP;
#ifndef NANO_TINY
@ -576,8 +579,9 @@ functionptrtype parse_help_input(int *kbinput)
case '/':
return do_search;
case 'N':
return do_findprevious;
case 'n':
return do_research;
return do_findnext;
case 'E':
case 'e':
case 'Q':

View File

@ -527,6 +527,10 @@ int parse_kbinput(WINDOW *win)
return ALT_LEFT;
} else if (retval == altright) {
return ALT_RIGHT;
} else if (retval == altup) {
return ALT_UP;
} else if (retval == altdown) {
return ALT_DOWN;
} else if (retval == shiftaltleft) {
shift_held = TRUE;
return KEY_HOME;