Added logic to support using replace all across documents.
This commit is contained in:
parent
8a98e18511
commit
d1833f6591
|
@ -499,6 +499,9 @@ do_replace_all (XedSearchbar *searchbar)
|
||||||
const gchar *replace_entry_text;
|
const gchar *replace_entry_text;
|
||||||
gchar *unescaped_replace_text;
|
gchar *unescaped_replace_text;
|
||||||
gint count;
|
gint count;
|
||||||
|
GtkSourceSearchSettings *search_settings;
|
||||||
|
|
||||||
|
search_settings = xed_searchbar_get_search_settings (searchbar);
|
||||||
|
|
||||||
doc = xed_window_get_active_document (searchbar->window);
|
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);
|
search_context = xed_document_get_search_context (doc);
|
||||||
|
|
||||||
if (search_context == NULL)
|
if (search_context == NULL && xed_searchbar_get_search_text (searchbar) == NULL)
|
||||||
{
|
{
|
||||||
return;
|
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 text may be "", we just delete all occurrences */
|
||||||
replace_entry_text = xed_searchbar_get_replace_text (searchbar);
|
replace_entry_text = xed_searchbar_get_replace_text (searchbar);
|
||||||
g_return_if_fail ((replace_entry_text) != NULL);
|
g_return_if_fail ((replace_entry_text) != NULL);
|
||||||
|
|
Loading…
Reference in New Issue