Search engine: fix errors with backward regex-search
Этот коммит содержится в:
родитель
5e08dbbe76
Коммит
15b2d19428
@ -1122,8 +1122,8 @@ editcmd_find (WEdit *edit, gsize *len)
|
||||
|
||||
if (edit->replace_backwards) {
|
||||
search_end = edit->curs1;
|
||||
while (search_start >= 0) {
|
||||
if (search_end - search_start > edit->search->original_len)
|
||||
while ((int) search_start >= 0) {
|
||||
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;
|
||||
if ( mc_search_run(edit->search, (void *) edit, search_start, search_end, len))
|
||||
{
|
||||
|
@ -317,3 +317,21 @@ mc_search_prepare_replace_str (mc_search_t * mc_search, GString * replace_str)
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
mc_search_is_fixed_search_str(mc_search_t * mc_search)
|
||||
{
|
||||
if (mc_search == NULL)
|
||||
return FALSE;
|
||||
switch (mc_search->search_type) {
|
||||
case MC_SEARCH_T_REGEX:
|
||||
case MC_SEARCH_T_GLOB:
|
||||
return FALSE;
|
||||
break;
|
||||
default:
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -105,4 +105,6 @@ mc_search_type_str_t *mc_search_types_list_get (void);
|
||||
|
||||
GString *mc_search_prepare_replace_str (mc_search_t * mc_search, GString * replace_str);
|
||||
|
||||
gboolean mc_search_is_fixed_search_str(mc_search_t *);
|
||||
|
||||
#endif
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user