Re: [Bug 60630] Changed - Cursor position not always displayed in GtkTextView
- From: "Padraig O'Briain" <Padraig Obriain Sun COM>
- To: hp redhat com
- Cc: gtk-devel-list gnome org
- Subject: Re: [Bug 60630] Changed - Cursor position not always displayed in GtkTextView
- Date: Tue, 18 Sep 2001 16:49:09 +0100 (BST)
It seems that the only place that pango_layout_index_to_pos() is called is in
gtk_text_layout_get_iter_location() so I propose the change below.
Padraig
>
> Hi,
>
> It seems likely to me that we need to fix Pango instead of the text
> view for this, so index_to_pos() or whatever returns the right value.
>
> Havoc
>
>
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Index: pango-layout.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-layout.c,v
retrieving revision 1.72
diff -u -p -r1.72 pango-layout.c
--- pango-layout.c 2001/09/02 17:56:49 1.72
+++ pango-layout.c 2001/09/18 15:46:05
@@ -1425,7 +1425,7 @@ pango_layout_index_to_pos (PangoLayout
PangoRectangle logical_rect;
PangoLayoutIter *iter;
PangoLayoutLine *layout_line = NULL;
- gboolean notfound = FALSE;
+ int x_pos;
g_return_if_fail (layout != NULL);
g_return_if_fail (index >= 0);
@@ -1455,33 +1455,22 @@ pango_layout_index_to_pos (PangoLayout
if (!pango_layout_iter_next_line (iter))
{
- notfound = TRUE;
+ /*
+ * Iterator should now be on the "NULL" run at the end of the last
+ * line or the end of any line if no wrapping is in effect.
+ */
break;
}
}
- if (notfound)
- {
- /* Iterator should now be on the "NULL" run at the end of the last
- * line, which is a zero-width rectangle. Return the extents of
- * that run.
- */
-
- pango_layout_iter_get_run_extents (iter, NULL, pos);
- }
- else
- {
- int x_pos;
+ pos->y = logical_rect.y;
+ pos->height = logical_rect.height;
- pos->y = logical_rect.y;
- pos->height = logical_rect.height;
+ pango_layout_line_index_to_x (layout_line, index, 0, &x_pos);
+ pos->x = logical_rect.x + x_pos;
- pango_layout_line_index_to_x (layout_line, index, 0, &x_pos);
- pos->x = logical_rect.x + x_pos;
-
- pango_layout_line_index_to_x (layout_line, index, 1, &x_pos);
- pos->width = (logical_rect.x + x_pos) - pos->x;
- }
+ pango_layout_line_index_to_x (layout_line, index, 1, &x_pos);
+ pos->width = (logical_rect.x + x_pos) - pos->x;
pango_layout_iter_free (iter);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]