Skip to content

Commit a32348f

Browse files
committed
nemo-file.c: Escape tooltip text for markup before adding any
search result snippet. Escaping the entire string would end up breaking highlighting markup when displaying search results (see c39f0f2).
1 parent 871e988 commit a32348f

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

libnemo-private/nemo-file.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8075,7 +8075,6 @@ nemo_file_construct_tooltip (NemoFile *file, NemoFileTooltipFlags flags, gpointe
80758075
gchar *nice = NULL;
80768076
gchar *tmp = NULL;
80778077
gchar *date;
8078-
gchar *ret;
80798078

80808079
if (g_strcmp0 (scheme, "x-nemo-desktop") == 0) {
80818080
g_free (scheme);
@@ -8164,6 +8163,10 @@ nemo_file_construct_tooltip (NemoFile *file, NemoFileTooltipFlags flags, gpointe
81648163
}
81658164
}
81668165

8166+
gchar *escaped = g_markup_escape_text (string->str, -1);
8167+
string = g_string_assign (string, escaped);
8168+
g_free (escaped);
8169+
81678170
if (search_dir != NULL) {
81688171
gchar *snippet = nemo_file_get_search_result_snippet (file, search_dir);
81698172
if (snippet != NULL) {
@@ -8175,12 +8178,8 @@ nemo_file_construct_tooltip (NemoFile *file, NemoFileTooltipFlags flags, gpointe
81758178
}
81768179
}
81778180

8178-
ret = string->str;
8179-
8180-
g_string_free (string, FALSE);
81818181
g_free (scheme);
8182-
8183-
return ret;
8182+
return g_string_free (string, FALSE);
81848183
}
81858184

81868185
gint

libnemo-private/nemo-icon-container.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6546,7 +6546,7 @@ nemo_icon_container_update_tooltip_text (NemoIconContainer *container,
65466546
file,
65476547
&text);
65486548

6549-
gtk_widget_set_tooltip_text (GTK_WIDGET (container), text);
6549+
gtk_widget_set_tooltip_markup (GTK_WIDGET (container), text);
65506550

65516551
g_free (text);
65526552
}

0 commit comments

Comments
 (0)