From 1bb36fd589c7662e8d61d9d57b60314466bef4a1 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 13 Apr 2013 20:53:45 +0400 Subject: [PATCH] Don't adjust viewer parameters twice after search in the hex mode. Signed-off-by: Andrew Borodin --- src/viewer/move.c | 14 +++++--------- src/viewer/search.c | 9 --------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/viewer/move.c b/src/viewer/move.c index 5762d7b11..fed973ba1 100644 --- a/src/viewer/move.c +++ b/src/viewer/move.c @@ -493,19 +493,15 @@ mcview_place_cursor (mcview_t * view) void mcview_moveto_match (mcview_t * view) { - off_t offset; - - offset = view->search_start; - if (view->hex_mode) { - view->hex_cursor = offset; - view->dpy_start = offset - offset % view->bytes_per_line; + view->hex_cursor = view->search_start; + view->hexedit_lownibble = FALSE; + view->dpy_start = view->search_start - view->search_start % view->bytes_per_line; + view->dpy_end = view->search_end - view->search_end % view->bytes_per_line; } else - { - view->dpy_start = mcview_bol (view, offset, 0); - } + view->dpy_start = mcview_bol (view, view->search_start, 0); mcview_scroll_to_cursor (view); view->dirty++; diff --git a/src/viewer/search.c b/src/viewer/search.c index 3f32b246a..ed26ee631 100644 --- a/src/viewer/search.c +++ b/src/viewer/search.c @@ -135,14 +135,6 @@ mcview_search_show_result (mcview_t * view, WDialog ** d, size_t match_len) match_len) : 0; view->search_end = view->search_start + match_len + nroff_len; - if (view->hex_mode) - { - view->hex_cursor = view->search_start; - view->hexedit_lownibble = FALSE; - view->dpy_start = view->search_start - view->search_start % view->bytes_per_line; - view->dpy_end = view->search_end - view->search_end % view->bytes_per_line; - } - if (verbose) { dlg_run_done (*d); @@ -151,7 +143,6 @@ mcview_search_show_result (mcview_t * view, WDialog ** d, size_t match_len) tty_refresh (); } mcview_moveto_match (view); - } /* --------------------------------------------------------------------------------------------- */