Ticket #3648: mc-3648-05-enable-backwards-view-search-update-status.patch

File mc-3648-05-enable-backwards-view-search-update-status.patch, 1.6 KB (added by and, 6 years ago)
  • src/viewer/search.c

    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) 
    250250    mc_search_cbret_t result = MC_SEARCH_CB_OK; 
    251251 
    252252    vsm->offset = (off_t) char_offset; 
    253     if (vsm->offset >= vsm->view->update_activate) 
     253    if (mcview_search_options.backwards) 
    254254    { 
    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; 
    256258 
    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        } 
    259262    } 
     263    else 
     264    { 
     265        if (vsm->offset >= vsm->view->update_activate) 
     266        { 
     267            vsm->view->update_activate += vsm->view->update_steps; 
    260268 
     269            if (sm->update (sm) == B_CANCEL) 
     270                result = MC_SEARCH_CB_ABORT; 
     271        } 
     272    } 
    261273    /* may be in future return from this callback will change current position in searching block. */ 
    262274 
    263275    return result;