Skip to content

Commit

Permalink
Fix showing Find/Replace regex errors on status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
ntrel committed Jan 3, 2012
1 parent 308f98a commit f0ca50c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/search.c
Expand Up @@ -150,6 +150,8 @@ static void search_close_pid(GPid child_pid, gint status, gpointer user_data);

static gchar **search_get_argv(const gchar **argv_prefix, const gchar *dir);

static GRegex *compile_regex(const gchar *str, gint sflags);


static void
on_find_replace_checkbutton_toggled(GtkToggleButton *togglebutton, gpointer user_data);
Expand Down Expand Up @@ -1236,7 +1238,14 @@ on_find_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
gtk_widget_grab_focus(find_dlg.entry);
return;
}
if (settings.find_escape_sequences && ~search_data.flags & SCFIND_REGEXP)
if (search_data.flags & SCFIND_REGEXP)
{
GRegex *regex = compile_regex(search_data.text, search_data.flags);
g_regex_unref(regex);
if (!regex)
goto fail;
}
else if (settings.find_escape_sequences)
{
if (! utils_str_replace_escape(search_data.text, FALSE))
goto fail;
Expand Down Expand Up @@ -1364,8 +1373,10 @@ on_replace_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)

if (search_flags_re & SCFIND_REGEXP)
{
GRegex *regex = compile_regex(find, search_flags_re);
g_regex_unref(regex);
/* find escapes will be handled by GRegex */
if (! utils_str_replace_escape(replace, TRUE))
if (!regex || !utils_str_replace_escape(replace, TRUE))
goto fail;
}
else if (search_replace_escape_re)
Expand Down

0 comments on commit f0ca50c

Please sign in to comment.