[gnome-control-center] shell: Don't change casedness when displaying matches
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] shell: Don't change casedness when displaying matches
- Date: Mon, 15 Nov 2010 23:02:40 +0000 (UTC)
commit b85950d8073b742a812af700a553f8380307398f
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Nov 15 12:43:54 2010 -0500
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 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/shell/shell-search-renderer.c b/shell/shell-search-renderer.c
index 6ed1866..42368da 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"
"<small>%s%s<b>%s</b>%s</small>",
priv->title, leaddot, lead,
- needle, trail);
+ match, trail);
+ g_free (match);
g_free (lead);
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]