[gedit/wip/use-gsv-search: 15/15] ViewFrame: unescape search text



commit 8fcfd14e6280f1ced2de30459168b6c76a7783dc
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Jul 1 11:32:30 2013 +0200

    ViewFrame: unescape search text

 gedit/gedit-view-frame.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gedit/gedit-view-frame.c b/gedit/gedit-view-frame.c
index 745b1bb..9fd2641 100644
--- a/gedit/gedit-view-frame.c
+++ b/gedit/gedit-view-frame.c
@@ -470,13 +470,17 @@ search_widget_key_press_event (GtkWidget      *widget,
                if (frame->priv->search_mode == SEARCH)
                {
                        GtkSourceBuffer *buffer;
+                       gchar *unescaped_search_text;
 
                        /* restore document search so that Find Next does the right thing */
                        buffer = GTK_SOURCE_BUFFER (gedit_view_frame_get_document (frame));
                        gtk_source_buffer_set_case_sensitive_search (buffer, 
frame->priv->old_case_sensitive_search);
                        gtk_source_buffer_set_search_at_word_boundaries (buffer, 
frame->priv->old_search_at_word_boundaries);
                        gtk_source_buffer_set_search_wrap_around (buffer, 
frame->priv->old_search_wrap_around);
-                       gtk_source_buffer_set_search_text (buffer, frame->priv->old_search_text);
+
+                       unescaped_search_text = gtk_source_utils_unescape_search_text 
(frame->priv->old_search_text);
+                       gtk_source_buffer_set_search_text (buffer, unescaped_search_text);
+                       g_free (unescaped_search_text);
                }
 
                hide_search_widget (frame, TRUE);
@@ -526,15 +530,19 @@ update_search (GeditViewFrame *frame)
 {
        GtkSourceBuffer *buffer;
        const gchar *entry_text;
+       gchar *unescaped_entry_text;
 
        buffer = GTK_SOURCE_BUFFER (gedit_view_frame_get_document (frame));
 
        entry_text = gtk_entry_get_text (frame->priv->search_entry);
+       unescaped_entry_text = gtk_source_utils_unescape_search_text (entry_text);
 
-       gtk_source_buffer_set_search_text (buffer, entry_text);
+       gtk_source_buffer_set_search_text (buffer, unescaped_entry_text);
        gtk_source_buffer_set_case_sensitive_search (buffer, frame->priv->case_sensitive_search);
        gtk_source_buffer_set_search_at_word_boundaries (buffer, frame->priv->search_at_word_boundaries);
        gtk_source_buffer_set_search_wrap_around (buffer, frame->priv->search_wrap_around);
+
+       g_free (unescaped_entry_text);
 }
 
 static void


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