diff --git a/xed/xed-searchbar.c b/xed/xed-searchbar.c index ac950a1..f6a8994 100755 --- a/xed/xed-searchbar.c +++ b/xed/xed-searchbar.c @@ -499,6 +499,9 @@ do_replace_all (XedSearchbar *searchbar) const gchar *replace_entry_text; gchar *unescaped_replace_text; gint count; + GtkSourceSearchSettings *search_settings; + + search_settings = xed_searchbar_get_search_settings (searchbar); doc = xed_window_get_active_document (searchbar->window); @@ -509,11 +512,18 @@ do_replace_all (XedSearchbar *searchbar) search_context = xed_document_get_search_context (doc); - if (search_context == NULL) + if (search_context == NULL && xed_searchbar_get_search_text (searchbar) == NULL) { return; } + if (search_context == NULL && xed_searchbar_get_search_text (searchbar) != NULL) + { + search_context = gtk_source_search_context_new (GTK_SOURCE_BUFFER (doc), search_settings); + + xed_document_set_search_context (doc, search_context); + } + /* replace text may be "", we just delete all occurrences */ replace_entry_text = xed_searchbar_get_replace_text (searchbar); g_return_if_fail ((replace_entry_text) != NULL);