Commit 56b1b8f2 authored by Sébastien Wilmet's avatar Sébastien Wilmet

Regex search: escape selection with g_regex_escape_string()

parent 2589ef2a
......@@ -562,7 +562,16 @@ show_cb (GeditReplaceDialog *dialog)
if (selection_exists && selection != NULL && selection_length < 80)
{
gchar *escaped_selection = gtk_source_utils_escape_search_text (selection);
gchar *escaped_selection;
if (gtk_source_search_settings_get_regex_enabled (dialog->priv->search_settings))
{
escaped_selection = g_regex_escape_string (selection, -1);
}
else
{
escaped_selection = gtk_source_utils_escape_search_text (selection);
}
gtk_entry_set_text (GTK_ENTRY (dialog->priv->search_text_entry),
escaped_selection);
......
......@@ -1232,7 +1232,16 @@ init_search_entry (GeditViewFrame *frame)
if (selection_exists && (search_text != NULL) && (selection_len <= 160))
{
gchar *search_text_escaped = gtk_source_utils_escape_search_text (search_text);
gchar *search_text_escaped;
if (gtk_source_search_settings_get_regex_enabled (frame->priv->search_settings))
{
search_text_escaped = g_regex_escape_string (search_text, -1);
}
else
{
search_text_escaped = gtk_source_utils_escape_search_text (search_text);
}
gtk_entry_set_text (GTK_ENTRY (frame->priv->search_entry),
search_text_escaped);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment