Ticket #3819: 3819_mcview_search_grow.patch

File 3819_mcview_search_grow.patch, 1.2 KB (added by andrew_b, 21 months ago)

Fix

  • src/viewer/search.c

    diff --git a/src/viewer/search.c b/src/viewer/search.c
    index d34cce3..cb4b4e4 100644
    a b mcview_do_search (WView * view, off_t want_search_start) 
    366366            break; 
    367367        } 
    368368 
    369         if (view->search->error == MC_SEARCH_E_ABORT || view->search->error == MC_SEARCH_E_NOTFOUND) 
     369        /* Search error is here. 
     370         * MC_SEARCH_E_NOTFOUND: continue search 
     371         * others: stop 
     372         */ 
     373        if (view->search->error != MC_SEARCH_E_NOTFOUND) 
    370374            break; 
    371375 
    372376        search_start = growbufsize - view->search->original_len; 
    373377    } 
    374378    while (search_start > 0 && mcview_may_still_grow (view)); 
    375379 
     380    /* After mcview_may_still_grow (view) == FALSE we can have skipped last chunk. Search there. */ 
     381    if (!found && view->search->error == MC_SEARCH_E_NOTFOUND && !mcview_search_options.backwards 
     382        && mcview_find (&vsm, search_start, mcview_get_filesize (view), &match_len)) 
     383    { 
     384        mcview_search_show_result (view, match_len); 
     385        found = TRUE; 
     386    } 
     387 
    376388    status_msg_deinit (STATUS_MSG (&vsm)); 
    377389 
    378390    if (orig_search_start != 0 && (!found && view->search->error == MC_SEARCH_E_NOTFOUND)