[geany/geany] f0ca50: Fix showing Find/Replace regex errors on status bar
Nick Treleaven
git-noreply at xxxxx
Thu Jul 26 00:02:41 UTC 2012
Branch: refs/heads/document-messages
Author: Nick Treleaven <nick.treleaven at btinternet.com>
Committer: Nick Treleaven <nick.treleaven at btinternet.com>
Date: Tue, 03 Jan 2012 16:21:12
Commit: f0ca50cf20995ed6faf7720e5e6134135c655cba
https://github.com/geany/geany/commit/f0ca50cf20995ed6faf7720e5e6134135c655cba
Log Message:
-----------
Fix showing Find/Replace regex errors on status bar
Modified Paths:
--------------
src/search.c
Modified: src/search.c
15 files changed, 13 insertions(+), 2 deletions(-)
===================================================================
@@ -150,6 +150,8 @@ enum
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);
@@ -1236,7 +1238,14 @@ gint search_mark_all(GeanyDocument *doc, const gchar *search_text, gint flags)
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;
@@ -1364,8 +1373,10 @@ static void replace_in_session(GeanyDocument *doc,
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)
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
More information about the Commits
mailing list