From a36b410b4368745011f683421d24cc22d13fd624 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Sat, 21 May 2016 14:31:38 +0000
Subject: [PATCH] Handle user abort on backwards view search
Currently backwards view search loops mc_search_run() until match or search end,
but not on user abort request.
Respect newly introduced MC_SEARCH_E_ABORT error status
and exit backwards search loop on user request.
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/viewer/search.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/viewer/search.c b/src/viewer/search.c
index 34ecfba..e0cf17b 100644
a
|
b
|
mcview_find (mcview_search_status_msg_t * ssm, off_t search_start, off_t search_ |
136 | 136 | && mc_search_is_fixed_search_str (view->search)) |
137 | 137 | search_end = search_start + view->search->original_len; |
138 | 138 | |
139 | | if (mc_search_run (view->search, (void *) ssm, search_start, search_end, len) |
140 | | && view->search->normal_offset == search_start) |
| 139 | if (mc_search_run (view->search, (void *) ssm, search_start, search_end, len)) |
141 | 140 | { |
142 | | if (view->text_nroff_mode) |
143 | | view->search->normal_offset++; |
144 | | return TRUE; |
| 141 | if (view->search->normal_offset == search_start) |
| 142 | { |
| 143 | if (view->text_nroff_mode) |
| 144 | view->search->normal_offset++; |
| 145 | return TRUE; |
| 146 | } |
145 | 147 | } |
| 148 | else if (view->search->error == MC_SEARCH_E_ABORT) |
| 149 | return FALSE; |
146 | 150 | |
147 | 151 | search_start--; |
148 | 152 | } |