Ticket #3280: mc-4.8.13-search_selected-offbyone.patch

File mc-4.8.13-search_selected-offbyone.patch, 1.7 KB (added by and, 5 years ago)

patch for search off-by-one between plain and hex mode

  • src/viewer/nroff.c

    bugfix for ticket #3280 - mcview: search off-by-one between plain and hex modes
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    
    diff -ruN mc-4.8.13/src/viewer/nroff.c mc-4.8.13.patch/src/viewer/nroff.c
    old new  
    202202            continue; 
    203203        } 
    204204 
    205         if (view->search_start <= from && from < view->search_end) 
     205        if (view->search_start < from && from <= view->search_end) 
    206206        { 
    207207            tty_setcolor (SELECTED_COLOR); 
    208208        } 
  • src/viewer/plain.c

    diff -ruN mc-4.8.13/src/viewer/plain.c mc-4.8.13.patch/src/viewer/plain.c
    old new  
    140140            continue; 
    141141        } 
    142142 
    143         if (view->search_start <= from && from < view->search_end) 
     143        if (view->search_start < from && from <= view->search_end) 
    144144            tty_setcolor (SELECTED_COLOR); 
    145145        else 
    146146            tty_setcolor (VIEW_NORMAL_COLOR); 
  • src/viewer/search.c

    diff -ruN mc-4.8.13/src/viewer/search.c mc-4.8.13.patch/src/viewer/search.c
    old new  
    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;