From 950e082f67b14ced345ca6e614efccd8723e98c8 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Sat, 21 May 2016 14:20:12 +0000
Subject: [PATCH] Enable backwards view search update status
Fix missing status update when searching backwards in mcview.
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/viewer/search.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/viewer/search.c b/src/viewer/search.c
index e0cf17b..d36bb49 100644
a
|
b
|
mcview_search_update_cmd_callback (const void *user_data, gsize char_offset) |
250 | 250 | mc_search_cbret_t result = MC_SEARCH_CB_OK; |
251 | 251 | |
252 | 252 | vsm->offset = (off_t) char_offset; |
253 | | if (vsm->offset >= vsm->view->update_activate) |
| 253 | if (mcview_search_options.backwards) |
254 | 254 | { |
255 | | vsm->view->update_activate += vsm->view->update_steps; |
| 255 | if (vsm->offset <= vsm->view->update_activate) |
| 256 | { |
| 257 | vsm->view->update_activate -= vsm->view->update_steps; |
256 | 258 | |
257 | | if (sm->update (sm) == B_CANCEL) |
258 | | result = MC_SEARCH_CB_ABORT; |
| 259 | if (sm->update (sm) == B_CANCEL) |
| 260 | result = MC_SEARCH_CB_ABORT; |
| 261 | } |
259 | 262 | } |
| 263 | else |
| 264 | { |
| 265 | if (vsm->offset >= vsm->view->update_activate) |
| 266 | { |
| 267 | vsm->view->update_activate += vsm->view->update_steps; |
260 | 268 | |
| 269 | if (sm->update (sm) == B_CANCEL) |
| 270 | result = MC_SEARCH_CB_ABORT; |
| 271 | } |
| 272 | } |
261 | 273 | /* may be in future return from this callback will change current position in searching block. */ |
262 | 274 | |
263 | 275 | return result; |