From 9aadcfe97067070a9d666bfb075eab47fd22b412 Mon Sep 17 00:00:00 2001 From: "S. Melnikov" Date: Thu, 27 Oct 2011 18:03:44 +0400 Subject: [PATCH] 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 a3ddfd14ea00a4a2018eeed133887d3865e1a19f) Signed-off-by: Ilia Maslakov --- lib/keybind.c | 4 ++++ lib/keybind.h | 4 ++++ misc/mc.keymap.default | 16 ++++++++++++---- misc/mc.keymap.emacs | 16 ++++++++++++---- src/keybind-defaults.c | 16 ++++++++++++---- src/viewer/actions_cmd.c | 16 ++++++++++++++++ 6 files changed, 60 insertions(+), 12 deletions(-) diff --git a/lib/keybind.c b/lib/keybind.c index 72c446192..ca55c1fe8 100644 --- a/lib/keybind.c +++ b/lib/keybind.c @@ -315,6 +315,10 @@ static name_keymap_t command_names[] = { {"NroffMode", CK_NroffMode}, {"BookmarkGoto", CK_BookmarkGoto}, {"Ruler", CK_Ruler}, + {"SearchForward", CK_SearchForward}, + {"SearchBackward", CK_SearchBackward}, + {"SearchForwardContinue", CK_SearchForwardContinue}, + {"SearchBackwardContinue", CK_SearchBackwardContinue}, #ifdef USE_DIFF_VIEW /* diff viewer */ diff --git a/lib/keybind.h b/lib/keybind.h index 33b8cfe91..7e16110eb 100644 --- a/lib/keybind.h +++ b/lib/keybind.h @@ -296,6 +296,10 @@ enum CK_HexEditMode, CK_BookmarkGoto, CK_Ruler, + CK_SearchForward, + CK_SearchBackward, + CK_SearchForwardContinue, + CK_SearchBackwardContinue, /* diff viewer */ CK_ShowSymbols = 700, diff --git a/misc/mc.keymap.default b/misc/mc.keymap.default index 2432ce86e..0611ec4e4 100644 --- a/misc/mc.keymap.default +++ b/misc/mc.keymap.default @@ -340,8 +340,12 @@ WrapMode = f2 Quit = f3; f10; q; esc HexMode = f4 Goto = f5 -Search = f7; question; slash -SearchContinue = ctrl-r; ctrl-s; f17; n +Search = f7 +SearchForward = slash +SearchBackward = question +SearchContinue = f17; n +SearchForwardContinue = ctrl-s +SearchBackwardContinue = ctrl-r MagicMode = f8 NroffMode = f9 Home = ctrl-a @@ -373,8 +377,12 @@ Quit = f3; f10; q; esc HexMode = f4 Goto = f5 Save = f6 -Search = f7; question; slash -SearchContinue = ctrl-r; ctrl-s; f17; n +Search = f7 +SearchForward = slash +SearchBackward = question +SearchContinue = f17; n +SearchForwardContinue = ctrl-s +SearchBackwardContinue = ctrl-r MagicMode = f8 NroffMode = f9 ToggleNavigation = tab diff --git a/misc/mc.keymap.emacs b/misc/mc.keymap.emacs index fb6f6231c..add0e2dc8 100644 --- a/misc/mc.keymap.emacs +++ b/misc/mc.keymap.emacs @@ -343,10 +343,14 @@ WrapMode = f2 Quit = f3; f10; q; esc HexMode = f4 Goto = f5 -Search = f7; question; slash +Search = f7 +SearchForward = slash +SearchBackward = question +SearchContinue = f17; n +SearchForwardContinue = ctrl-s +SearchBackwardContinue = ctrl-r MagicMode = f8 NroffMode = f9 -SearchContinue = ctrl-r; ctrl-s; f17; n Home = ctrl-a End = ctrl-e Left = h; left @@ -376,8 +380,12 @@ Quit = f3; f10; q; esc HexMode = f4 Goto = f5 Save = f6 -Search = f7; question; slash -SearchContinue = ctrl-r; ctrl-s; f17; n +Search = f7 +SearchForward = slash +SearchBackward = question +SearchContinue = f17; n +SearchForwardContinue = ctrl-s +SearchBackwardContinue = ctrl-r MagicMode = f8 NroffMode = f9 ToggleNavigation = tab diff --git a/src/keybind-defaults.c b/src/keybind-defaults.c index 06827c9dc..ef5ea692d 100644 --- a/src/keybind-defaults.c +++ b/src/keybind-defaults.c @@ -429,8 +429,8 @@ static const global_keymap_ini_t default_viewer_keymap[] = { {"Quit", "f3; f10; q; esc"}, {"HexMode", "f4"}, {"Goto", "f5"}, - {"Search", "f7; question; slash"}, - {"SearchContinue", "ctrl-r; ctrl-s; f17; n"}, + {"Search", "f7"}, + {"SearchContinue", "f17; n"}, {"MagicMode", "f8"}, {"NroffMode", "f9"}, {"Home", "ctrl-a"}, @@ -456,6 +456,10 @@ static const global_keymap_ini_t default_viewer_keymap[] = { #endif {"Shell", "ctrl-o"}, {"Ruler", "alt-r"}, + {"SearchForward", "slash"}, + {"SearchBackward", "question"}, + {"SearchForwardContinue", "ctrl-s"}, + {"SearchBackwardContinue", "ctrl-r"}, {NULL, NULL} }; @@ -467,8 +471,8 @@ static const global_keymap_ini_t default_viewer_hex_keymap[] = { {"HexMode", "f4"}, {"Goto", "f5"}, {"Save", "f6"}, - {"Search", "f7; question; slash"}, - {"SearchContinue", "ctrl-r; ctrl-s; f17; n"}, + {"Search", "f7"}, + {"SearchContinue", "f17; n"}, {"MagicMode", "f8"}, {"NroffMode", "f9"}, {"ToggleNavigation", "tab"}, @@ -486,6 +490,10 @@ static const global_keymap_ini_t default_viewer_hex_keymap[] = { {"SelectCodepage", "alt-e"}, #endif {"Shell", "ctrl-o"}, + {"SearchForward", "slash"}, + {"SearchBackward", "question"}, + {"SearchForwardContinue", "ctrl-s"}, + {"SearchBackwardContinue", "ctrl-r"}, {NULL, NULL} }; diff --git a/src/viewer/actions_cmd.c b/src/viewer/actions_cmd.c index 91178a590..46534f9a7 100644 --- a/src/viewer/actions_cmd.c +++ b/src/viewer/actions_cmd.c @@ -287,6 +287,14 @@ mcview_execute_cmd (mcview_t * view, unsigned long command) case CK_Search: mcview_search (view); 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: mcview_toggle_magic_mode (view); break; @@ -320,6 +328,14 @@ mcview_execute_cmd (mcview_t * view, unsigned long command) case CK_SearchContinue: mcview_continue_search_cmd (view); 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: mcview_display_toggle_ruler (view); break;