[gtksourceview] SearchContext: replace() and replace_all(): clear replace error



commit fda55187ab3fb7abaf0294bbe26accc1ac5f5681
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Aug 19 21:06:06 2013 +0200

    SearchContext: replace() and replace_all(): clear replace error

 gtksourceview/gtksourcesearchcontext.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcesearchcontext.c b/gtksourceview/gtksourcesearchcontext.c
index 142bacf..deed7d8 100644
--- a/gtksourceview/gtksourcesearchcontext.c
+++ b/gtksourceview/gtksourcesearchcontext.c
@@ -3460,6 +3460,21 @@ regex_replace (GtkSourceSearchContext *search,
        return TRUE;
 }
 
+static void
+clear_replace_error (GtkSourceSearchContext *search)
+{
+       if (search->priv->regex_state == GTK_SOURCE_REGEX_SEARCH_REPLACE_ERROR)
+       {
+               search->priv->regex_state = GTK_SOURCE_REGEX_SEARCH_NO_ERROR;
+
+               g_error_free (search->priv->regex_error);
+               search->priv->regex_error = NULL;
+
+               g_object_notify (G_OBJECT (search), "regex-error");
+               g_object_notify (G_OBJECT (search), "regex-state");
+       }
+}
+
 /**
  * gtk_source_search_context_replace:
  * @search: a #GtkSourceSearchContext.
@@ -3498,6 +3513,8 @@ gtk_source_search_context_replace (GtkSourceSearchContext *search,
                return FALSE;
        }
 
+       clear_replace_error (search);
+
        if (!smart_forward_search (search, match_start, &start, &end))
        {
                return FALSE;
@@ -3558,6 +3575,8 @@ gtk_source_search_context_replace_all (GtkSourceSearchContext *search,
                return 0;
        }
 
+       clear_replace_error (search);
+
        if (gtk_source_search_settings_get_regex_enabled (search->priv->settings))
        {
                if (search->priv->regex == NULL ||


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]