Ticket #1496: mc-4.7.0-pre1.search_backwards.patch

File mc-4.7.0-pre1.search_backwards.patch, 2.0 KB (added by dborca, 15 years ago)
  • edit/editcmd.c

    diff -Naur mc-4.7.0-pre1~/edit/editcmd.c mc-4.7.0-pre1/edit/editcmd.c
    old new  
    12801280    gsize search_end; 
    12811281 
    12821282    if (edit->replace_backwards) { 
    1283         search_end = edit->curs1-1; 
     1283        search_end = edit->last_byte; 
    12841284        while ((int) search_start >= 0) { 
    1285             if (search_end - search_start > edit->search->original_len && mc_search_is_fixed_search_str(edit->search)) 
    1286                 search_end = search_start + edit->search->original_len +1; 
    1287             if ( mc_search_run(edit->search, (void *) edit, search_start, search_end, len)) 
     1285            if (search_end > search_start + edit->search->original_len && mc_search_is_fixed_search_str(edit->search)) 
     1286                search_end = search_start + edit->search->original_len; 
     1287            if ( mc_search_run(edit->search, (void *) edit, search_start, search_end, len) 
     1288                && edit->search->normal_offset == search_start ) 
    12881289            { 
    12891290                return TRUE; 
    12901291            } 
  • mc-4.7.0-pre1

    diff -Naur mc-4.7.0-pre1~/src/view.c mc-4.7.0-pre1/src/view.c
    old new  
    31463146    if (view->search_backwards) { 
    31473147        search_end = view_get_filesize (view); 
    31483148        while ((int) search_start >= 0) { 
    3149             if (search_end - search_start > view->search->original_len && mc_search_is_fixed_search_str(view->search)) 
     3149            if (search_end > search_start + view->search->original_len && mc_search_is_fixed_search_str(view->search)) 
    31503150                search_end = search_start + view->search->original_len; 
    31513151 
    31523152            view_read_start (view, &view->search_onechar_info, search_start); 
    31533153 
    3154             if ( mc_search_run(view->search, (void *) view, search_start, search_end, len)) 
     3154            if ( mc_search_run(view->search, (void *) view, search_start, search_end, len) 
     3155                && view->search->normal_offset == search_start ) 
    31553156                return TRUE; 
    31563157 
    31573158            search_start--;