From b85950d8073b742a812af700a553f8380307398f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 15 Nov 2010 12:43:54 -0500 Subject: [PATCH] shell: Don't change casedness when displaying matches While we do want to match case-insensitively, we don't want to display the search result in all-lowercase. This patch is probably not quite utf8-ly correct. http://bugzilla.gnome.org/show_bug.cgi?id=634923 --- shell/shell-search-renderer.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/shell/shell-search-renderer.c b/shell/shell-search-renderer.c index 6ed186600..42368daad 100644 --- a/shell/shell-search-renderer.c +++ b/shell/shell-search-renderer.c @@ -159,27 +159,31 @@ shell_search_renderer_set_layout (ShellSearchRenderer *cell, GtkWidget *widget) { gchar *start; gchar *lead, *trail, *leaddot; + gchar *match; gint count; + #define CONTEXT 10 count = strlen (needle); - start = strstr (haystack, needle); + start = full_string + (strstr (haystack, needle) - haystack); - lead = MAX (start - CONTEXT, haystack); + lead = MAX (start - CONTEXT, full_string); trail = start + count; - if (lead == haystack) + if (lead == full_string) leaddot = ""; else leaddot = "..."; + match = g_strndup (start, count); lead = g_strndup (lead, start - lead); display_string = g_markup_printf_escaped ("%s\n" "%s%s%s%s", priv->title, leaddot, lead, - needle, trail); + match, trail); + g_free (match); g_free (lead); } else