diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | pango/pango-layout.c | 8 |
2 files changed, 16 insertions, 0 deletions
@@ -1,3 +1,11 @@ +2008-08-11 Behdad Esfahbod <behdad@gnome.org> + + 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 <behdad@gnome.org> * 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; |