Ticket #2105 (mcview backward search)

Until 4.7 '/' was forward and '?' backward search.
    In current releases both keys are bound to ViewSearch
    so one must manually choose Backwards option in the dialog.

(cherry picked from commit a3ddfd14ea)

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
S. Melnikov 2011-10-27 18:03:44 +04:00 committed by Andrew Borodin
parent 8b5e5e5430
commit 9aadcfe970
6 changed files with 60 additions and 12 deletions

View File

@ -315,6 +315,10 @@ static name_keymap_t command_names[] = {
{"NroffMode", CK_NroffMode}, {"NroffMode", CK_NroffMode},
{"BookmarkGoto", CK_BookmarkGoto}, {"BookmarkGoto", CK_BookmarkGoto},
{"Ruler", CK_Ruler}, {"Ruler", CK_Ruler},
{"SearchForward", CK_SearchForward},
{"SearchBackward", CK_SearchBackward},
{"SearchForwardContinue", CK_SearchForwardContinue},
{"SearchBackwardContinue", CK_SearchBackwardContinue},
#ifdef USE_DIFF_VIEW #ifdef USE_DIFF_VIEW
/* diff viewer */ /* diff viewer */

View File

@ -296,6 +296,10 @@ enum
CK_HexEditMode, CK_HexEditMode,
CK_BookmarkGoto, CK_BookmarkGoto,
CK_Ruler, CK_Ruler,
CK_SearchForward,
CK_SearchBackward,
CK_SearchForwardContinue,
CK_SearchBackwardContinue,
/* diff viewer */ /* diff viewer */
CK_ShowSymbols = 700, CK_ShowSymbols = 700,

View File

@ -340,8 +340,12 @@ WrapMode = f2
Quit = f3; f10; q; esc Quit = f3; f10; q; esc
HexMode = f4 HexMode = f4
Goto = f5 Goto = f5
Search = f7; question; slash Search = f7
SearchContinue = ctrl-r; ctrl-s; f17; n SearchForward = slash
SearchBackward = question
SearchContinue = f17; n
SearchForwardContinue = ctrl-s
SearchBackwardContinue = ctrl-r
MagicMode = f8 MagicMode = f8
NroffMode = f9 NroffMode = f9
Home = ctrl-a Home = ctrl-a
@ -373,8 +377,12 @@ Quit = f3; f10; q; esc
HexMode = f4 HexMode = f4
Goto = f5 Goto = f5
Save = f6 Save = f6
Search = f7; question; slash Search = f7
SearchContinue = ctrl-r; ctrl-s; f17; n SearchForward = slash
SearchBackward = question
SearchContinue = f17; n
SearchForwardContinue = ctrl-s
SearchBackwardContinue = ctrl-r
MagicMode = f8 MagicMode = f8
NroffMode = f9 NroffMode = f9
ToggleNavigation = tab ToggleNavigation = tab

View File

@ -343,10 +343,14 @@ WrapMode = f2
Quit = f3; f10; q; esc Quit = f3; f10; q; esc
HexMode = f4 HexMode = f4
Goto = f5 Goto = f5
Search = f7; question; slash Search = f7
SearchForward = slash
SearchBackward = question
SearchContinue = f17; n
SearchForwardContinue = ctrl-s
SearchBackwardContinue = ctrl-r
MagicMode = f8 MagicMode = f8
NroffMode = f9 NroffMode = f9
SearchContinue = ctrl-r; ctrl-s; f17; n
Home = ctrl-a Home = ctrl-a
End = ctrl-e End = ctrl-e
Left = h; left Left = h; left
@ -376,8 +380,12 @@ Quit = f3; f10; q; esc
HexMode = f4 HexMode = f4
Goto = f5 Goto = f5
Save = f6 Save = f6
Search = f7; question; slash Search = f7
SearchContinue = ctrl-r; ctrl-s; f17; n SearchForward = slash
SearchBackward = question
SearchContinue = f17; n
SearchForwardContinue = ctrl-s
SearchBackwardContinue = ctrl-r
MagicMode = f8 MagicMode = f8
NroffMode = f9 NroffMode = f9
ToggleNavigation = tab ToggleNavigation = tab

View File

@ -429,8 +429,8 @@ static const global_keymap_ini_t default_viewer_keymap[] = {
{"Quit", "f3; f10; q; esc"}, {"Quit", "f3; f10; q; esc"},
{"HexMode", "f4"}, {"HexMode", "f4"},
{"Goto", "f5"}, {"Goto", "f5"},
{"Search", "f7; question; slash"}, {"Search", "f7"},
{"SearchContinue", "ctrl-r; ctrl-s; f17; n"}, {"SearchContinue", "f17; n"},
{"MagicMode", "f8"}, {"MagicMode", "f8"},
{"NroffMode", "f9"}, {"NroffMode", "f9"},
{"Home", "ctrl-a"}, {"Home", "ctrl-a"},
@ -456,6 +456,10 @@ static const global_keymap_ini_t default_viewer_keymap[] = {
#endif #endif
{"Shell", "ctrl-o"}, {"Shell", "ctrl-o"},
{"Ruler", "alt-r"}, {"Ruler", "alt-r"},
{"SearchForward", "slash"},
{"SearchBackward", "question"},
{"SearchForwardContinue", "ctrl-s"},
{"SearchBackwardContinue", "ctrl-r"},
{NULL, NULL} {NULL, NULL}
}; };
@ -467,8 +471,8 @@ static const global_keymap_ini_t default_viewer_hex_keymap[] = {
{"HexMode", "f4"}, {"HexMode", "f4"},
{"Goto", "f5"}, {"Goto", "f5"},
{"Save", "f6"}, {"Save", "f6"},
{"Search", "f7; question; slash"}, {"Search", "f7"},
{"SearchContinue", "ctrl-r; ctrl-s; f17; n"}, {"SearchContinue", "f17; n"},
{"MagicMode", "f8"}, {"MagicMode", "f8"},
{"NroffMode", "f9"}, {"NroffMode", "f9"},
{"ToggleNavigation", "tab"}, {"ToggleNavigation", "tab"},
@ -486,6 +490,10 @@ static const global_keymap_ini_t default_viewer_hex_keymap[] = {
{"SelectCodepage", "alt-e"}, {"SelectCodepage", "alt-e"},
#endif #endif
{"Shell", "ctrl-o"}, {"Shell", "ctrl-o"},
{"SearchForward", "slash"},
{"SearchBackward", "question"},
{"SearchForwardContinue", "ctrl-s"},
{"SearchBackwardContinue", "ctrl-r"},
{NULL, NULL} {NULL, NULL}
}; };

View File

@ -287,6 +287,14 @@ mcview_execute_cmd (mcview_t * view, unsigned long command)
case CK_Search: case CK_Search:
mcview_search (view); mcview_search (view);
break; break;
case CK_SearchForward:
mcview_search_options.backwards = FALSE;
mcview_search (view);
break;
case CK_SearchBackward:
mcview_search_options.backwards = TRUE;
mcview_search (view);
break;
case CK_MagicMode: case CK_MagicMode:
mcview_toggle_magic_mode (view); mcview_toggle_magic_mode (view);
break; break;
@ -320,6 +328,14 @@ mcview_execute_cmd (mcview_t * view, unsigned long command)
case CK_SearchContinue: case CK_SearchContinue:
mcview_continue_search_cmd (view); mcview_continue_search_cmd (view);
break; break;
case CK_SearchForwardContinue:
mcview_search_options.backwards = FALSE;
mcview_continue_search_cmd (view);
break;
case CK_SearchBackwardContinue:
mcview_search_options.backwards = TRUE;
mcview_continue_search_cmd (view);
break;
case CK_Ruler: case CK_Ruler:
mcview_display_toggle_ruler (view); mcview_display_toggle_ruler (view);
break; break;