[gtk+/gtk-2.90] Make selecting the last character work again
- From: Christian Dywan <cdywan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2.90] Make selecting the last character work again
- Date: Fri, 16 Oct 2009 13:54:47 +0000 (UTC)
commit 3fcafb4bd8b8fa537bf6c5174b284343e829d099
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 9 07:08:54 2009 +0200
Make selecting the last character work again
This broke when I added link support. git bisect helped to track it
down.
gtk/gtklabel.c | 28 +++++++++++++---------------
1 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 5225968..0a9ac6d 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3800,6 +3800,7 @@ get_layout_index (GtkLabel *label,
gint trailing = 0;
const gchar *cluster;
const gchar *cluster_end;
+ gboolean inside;
*index = 0;
@@ -3810,24 +3811,21 @@ get_layout_index (GtkLabel *label,
x *= PANGO_SCALE;
y *= PANGO_SCALE;
- if (pango_layout_xy_to_index (label->layout,
- x, y,
- index, &trailing))
- {
- cluster = label->text + *index;
- cluster_end = cluster;
- while (trailing)
- {
- cluster_end = g_utf8_next_char (cluster_end);
- --trailing;
- }
-
- *index += (cluster_end - cluster);
+ inside = pango_layout_xy_to_index (label->layout,
+ x, y,
+ index, &trailing);
- return TRUE;
+ cluster = label->text + *index;
+ cluster_end = cluster;
+ while (trailing)
+ {
+ cluster_end = g_utf8_next_char (cluster_end);
+ --trailing;
}
- return FALSE;
+ *index += (cluster_end - cluster);
+
+ return inside;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]