Commit 3da75b4d authored by Sébastien Wilmet's avatar Sébastien Wilmet

Search and replace: work with the original search text

Not through the SearchSettings.
parent 9e570c58
......@@ -135,15 +135,11 @@ static void
text_not_found (GeditWindow *window,
GeditReplaceDialog *replace_dialog)
{
GtkSourceSearchSettings *search_settings;
const gchar *search_text;
gchar *escaped_search_text;
gchar *truncated_text;
search_settings = gedit_replace_dialog_get_search_settings (replace_dialog);
search_text = gtk_source_search_settings_get_search_text (search_settings);
escaped_search_text = gtk_source_utils_escape_search_text (search_text);
truncated_text = gedit_utils_str_end_truncate (escaped_search_text, MAX_MSG_LENGTH);
search_text = gedit_replace_dialog_get_search_text (replace_dialog);
truncated_text = gedit_utils_str_end_truncate (search_text, MAX_MSG_LENGTH);
gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
window->priv->generic_message_cid,
......@@ -151,7 +147,6 @@ text_not_found (GeditWindow *window,
entered by the user in the search box */
_("\"%s\" not found"), truncated_text);
g_free (escaped_search_text);
g_free (truncated_text);
}
......
......@@ -312,6 +312,18 @@ gedit_replace_dialog_get_search_settings (GeditReplaceDialog *dialog)
return dialog->priv->search_settings;
}
/* This function returns the original search text. The search text from the
* search settings has been unescaped, and the escape function is not
* reciprocal. So to avoid bugs, we have to deal with the original search text.
*/
const gchar *
gedit_replace_dialog_get_search_text (GeditReplaceDialog *dialog)
{
g_return_val_if_fail (GEDIT_IS_REPLACE_DIALOG (dialog), NULL);
return gtk_entry_get_text (GTK_ENTRY (dialog->priv->search_text_entry));
}
void
gedit_replace_dialog_set_search_text (GeditReplaceDialog *dialog,
const gchar *search_text)
......
......@@ -92,13 +92,15 @@ void gedit_replace_dialog_present_with_time (GeditReplaceDialog *dialog,
const gchar *gedit_replace_dialog_get_replace_text (GeditReplaceDialog *dialog);
gboolean gedit_replace_dialog_get_backwards (GeditReplaceDialog *dialog);
GtkSourceSearchSettings *gedit_replace_dialog_get_search_settings (GeditReplaceDialog *dialog);
const gchar *gedit_replace_dialog_get_search_text (GeditReplaceDialog *dialog);
void gedit_replace_dialog_set_search_text (GeditReplaceDialog *dialog,
const gchar *search_text);
gboolean gedit_replace_dialog_get_backwards (GeditReplaceDialog *dialog);
GtkSourceSearchSettings *gedit_replace_dialog_get_search_settings (GeditReplaceDialog *dialog);
void gedit_replace_dialog_set_search_error (GeditReplaceDialog *dialog,
const gchar *error_msg);
......
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