diff -Naur mc-4.7.0-pre1~/edit/edit-widget.h mc-4.7.0-pre1/edit/edit-widget.h
old
|
new
|
|
62 | 62 | int replace_mode; |
63 | 63 | int replace_backwards; |
64 | 64 | int replace_case; |
| 65 | int replace_in_selection; |
65 | 66 | int all_codepages; |
66 | 67 | |
67 | 68 | long search_start; /* First character to start searching from */ |
diff -Naur mc-4.7.0-pre1~/edit/editcmd.c mc-4.7.0-pre1/edit/editcmd.c
old
|
new
|
|
1276 | 1276 | static gboolean |
1277 | 1277 | editcmd_find (WEdit *edit, gsize *len) |
1278 | 1278 | { |
| 1279 | long search_lo = 0; |
| 1280 | long search_hi = edit->last_byte; |
| 1281 | |
1279 | 1282 | gsize search_start = edit->search_start; |
1280 | 1283 | gsize search_end; |
1281 | 1284 | |
| 1285 | if (edit->replace_in_selection) { |
| 1286 | if (eval_marks(edit, &search_lo, &search_hi)) { |
| 1287 | edit->search->error = MC_SEARCH_E_NOTFOUND; |
| 1288 | edit->search->error_str = g_strdup(_(" Search string not found ")); |
| 1289 | return FALSE; |
| 1290 | } |
| 1291 | if (edit->replace_backwards) { |
| 1292 | if (search_start > search_hi) { |
| 1293 | search_start = search_hi; |
| 1294 | } |
| 1295 | } else { |
| 1296 | if (search_start < search_lo) { |
| 1297 | search_start = search_lo; |
| 1298 | } |
| 1299 | } |
| 1300 | } |
| 1301 | |
1282 | 1302 | if (edit->replace_backwards) { |
1283 | | search_end = edit->curs1-1; |
1284 | | 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)) |
| 1303 | search_end = search_hi; |
| 1304 | while ((int) search_start >= search_lo) { |
| 1305 | if (search_end > search_start + edit->search->original_len && mc_search_is_fixed_search_str(edit->search)) |
| 1306 | search_end = search_start + edit->search->original_len; |
| 1307 | if ( mc_search_run(edit->search, (void *) edit, search_start, search_end, len) |
| 1308 | && edit->search->normal_offset == search_start ) |
1288 | 1309 | { |
1289 | 1310 | return TRUE; |
1290 | 1311 | } |
… |
… |
|
1292 | 1313 | } |
1293 | 1314 | edit->search->error_str = g_strdup(_(" Search string not found ")); |
1294 | 1315 | } else { |
1295 | | return mc_search_run(edit->search, (void *) edit, edit->search_start, edit->last_byte, len); |
| 1316 | return mc_search_run(edit->search, (void *) edit, search_start, search_hi, len); |
1296 | 1317 | } |
1297 | 1318 | return FALSE; |
1298 | 1319 | } |