Ticket #1496 (Search backwards is broken)

fix: file edit/editcmd.c backward search is broken
This commit is contained in:
Daniel Borca 2009-08-08 05:21:10 +00:00 committed by Slava Zanko
parent 646b11a7ce
commit 2a586710b7

View File

@ -1289,11 +1289,12 @@ editcmd_find (WEdit *edit, gsize *len)
gsize search_end; gsize search_end;
if (edit->replace_backwards) { if (edit->replace_backwards) {
search_end = edit->curs1-1; search_end = edit->last_byte;
while ((int) search_start >= 0) { while ((int) search_start >= 0) {
if (search_end - search_start > edit->search->original_len && mc_search_is_fixed_search_str(edit->search)) if (search_end > search_start + edit->search->original_len && mc_search_is_fixed_search_str(edit->search))
search_end = search_start + edit->search->original_len +1; search_end = search_start + edit->search->original_len;
if ( mc_search_run(edit->search, (void *) edit, search_start, search_end, len)) if ( mc_search_run(edit->search, (void *) edit, search_start, search_end, len)
&& edit->search->normal_offset == search_start )
{ {
return TRUE; return TRUE;
} }