From 681f92d78c2623ddb998018d3743a54f07680b69 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 11 Aug 2008 18:17:23 +0000 Subject: =?UTF-8?q?Bug=20547303=20=E2=80=93=20pango=5Flayout=5Fget=5Fcurso?= =?UTF-8?q?r=5Fpos=20crashes=20on=20certain=20text=20buffers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2008-08-11 Behdad Esfahbod Bug 547303 – pango_layout_get_cursor_pos crashes on certain text buffers * pango/pango-layout.c (pango_layout_get_cursor_pos): Handle cursor position in the middle of a "\r\n" cluster. svn path=/trunk/; revision=2688 --- ChangeLog | 8 ++++++++ pango/pango-layout.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index c7e2c68a..0fd22495 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-08-11 Behdad Esfahbod + + Bug 547303 – pango_layout_get_cursor_pos crashes on certain text + buffers + + * pango/pango-layout.c (pango_layout_get_cursor_pos): Handle cursor + position in the middle of a "\r\n" cluster. + 2008-08-06 Behdad Esfahbod * pango/pangocairo-render.c (pango_cairo_renderer_draw_glyph_item): diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 1df4b03c..262b4035 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -2194,6 +2194,14 @@ pango_layout_get_cursor_pos (PangoLayout *layout, else x1_trailing = line_rect.width; } + else if (index >= layout_line->start_index + layout_line->length) + { + dir1 = layout_line->resolved_dir; + if (layout_line->resolved_dir == PANGO_DIRECTION_LTR) + x1_trailing = line_rect.width; + else + x1_trailing = 0; + } else { gint prev_index = g_utf8_prev_char (layout->text + index) - layout->text; -- cgit v1.2.1