Commit 2589ef2a authored by Sébastien Wilmet's avatar Sébastien Wilmet

Regex search: do not unescape search text

\n, \t and \r are already supported by the regex search. No need to
unescape those character sequences.
parent ac1c42a6
......@@ -475,18 +475,25 @@ search_text_entry_changed (GtkEditable *editable,
GeditReplaceDialog *dialog)
{
const gchar *search_text;
gchar *unescaped_search_text;
search_text = gtk_entry_get_text (GTK_ENTRY (editable));
unescaped_search_text = gtk_source_utils_unescape_search_text (search_text);
if (gtk_source_search_settings_get_regex_enabled (dialog->priv->search_settings))
{
gtk_source_search_settings_set_search_text (dialog->priv->search_settings,
search_text);
}
else
{
gchar *unescaped_search_text = gtk_source_utils_unescape_search_text (search_text);
gtk_source_search_settings_set_search_text (dialog->priv->search_settings,
unescaped_search_text);
gtk_source_search_settings_set_search_text (dialog->priv->search_settings,
unescaped_search_text);
update_responses_sensitivity (dialog);
g_free (unescaped_search_text);
}
g_free (unescaped_search_text);
update_responses_sensitivity (dialog);
}
/* TODO: move in gedit-document.c and share it with gedit-view-frame */
......
......@@ -701,20 +701,25 @@ install_update_entry_tag_idle (GeditViewFrame *frame)
static void
update_search_text (GeditViewFrame *frame)
{
const gchar *entry_text;
gchar *unescaped_entry_text;
entry_text = gtk_entry_get_text (GTK_ENTRY (frame->priv->search_entry));
const gchar *entry_text = gtk_entry_get_text (GTK_ENTRY (frame->priv->search_entry));
g_free (frame->priv->search_text);
frame->priv->search_text = g_strdup (entry_text);
unescaped_entry_text = gtk_source_utils_unescape_search_text (entry_text);
if (gtk_source_search_settings_get_regex_enabled (frame->priv->search_settings))
{
gtk_source_search_settings_set_search_text (frame->priv->search_settings,
entry_text);
}
else
{
gchar *unescaped_entry_text = gtk_source_utils_unescape_search_text (entry_text);
gtk_source_search_settings_set_search_text (frame->priv->search_settings,
unescaped_entry_text);
gtk_source_search_settings_set_search_text (frame->priv->search_settings,
unescaped_entry_text);
g_free (unescaped_entry_text);
g_free (unescaped_entry_text);
}
}
static void
......
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