Ticket #3280: mc-3280-search-off-by-one-v2.patch

File mc-3280-search-off-by-one-v2.patch, 1.1 KB (added by egmont, 10 years ago)

My fix

  • src/viewer/ascii.c

    diff --git a/src/viewer/ascii.c b/src/viewer/ascii.c
    index b6848e2..1ed085a 100644
    a b mcview_display_line (mcview_t * view, mcview_state_machine_t * state, int row, 
    617617            return (col > 0) ? 1 : 0; 
    618618        } 
    619619 
    620         if (view->search_start <= state->offset && state->offset < view->search_end) 
     620        if (view->search_start <= state_saved.offset && state_saved.offset < view->search_end) 
    621621            color = SELECTED_COLOR; 
    622622 
    623623        if (cs[0] == '\n') 
  • src/viewer/search.c

    diff --git a/src/viewer/search.c b/src/viewer/search.c
    index 915bb85..40fcc29 100644
    a b mcview_search_show_result (mcview_t * view, size_t match_len) 
    168168                                      view->search->normal_offset - view->search->start_buffer) : 0; 
    169169    view->search_start = view->search->normal_offset + nroff_len; 
    170170 
    171     if (!view->hex_mode) 
    172         view->search_start++; 
    173  
    174171    nroff_len = 
    175172        view->text_nroff_mode ? mcview__get_nroff_real_len (view, view->search_start - 1, 
    176173                                                            match_len) : 0;