diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2005-11-18 23:05:15 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2005-11-18 23:05:15 +0000 |
commit | aeceaa7a811295204d0f11f208e8c3fa4d641d85 (patch) | |
tree | bf375d854fe7b47f15b48bb613f730e61b76be55 /pango/pango-layout.c | |
parent | 1b48e9f5f8007379f87336ea5ee852f98ab2aebd (diff) | |
download | pango-aeceaa7a811295204d0f11f208e8c3fa4d641d85.tar.gz |
Use the new support for negative offsets in g_utf8_pointer_to_offset. So
2005-11-18 Behdad Esfahbod <behdad@gnome.org>
* pango/pango-layout.c (pango_layout_move_cursor_visually): Use the
new support for negative offsets in g_utf8_pointer_to_offset. So now,
we simply do:
offset += g_utf8_pointer_to_offset(text+oldindex, text+newindex),
instead of doing
offset = g_utf8_pointer_to_offset(text, text+index) as we did before.
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r-- | pango/pango-layout.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 057f8357..ec4f285c 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -1422,11 +1422,14 @@ pango_layout_move_cursor_visually (PangoLayout *layout, vis2log_map = pango_layout_line_get_vis2log_map (line, strong); + log_pos = g_utf8_pointer_to_offset (layout->text + line->start_index, + layout->text + line->start_index + vis2log_map[vis_pos]); do { + int vis_pos_old = vis_pos; vis_pos += direction > 0 ? 1 : -1; - log_pos = g_utf8_pointer_to_offset (layout->text + line->start_index, - layout->text + line->start_index + vis2log_map[vis_pos]); + log_pos += g_utf8_pointer_to_offset (layout->text + line->start_index + vis2log_map[vis_pos_old], + layout->text + line->start_index + vis2log_map[vis_pos]); } while (vis_pos > 0 && vis_pos < n_vis && !layout->log_attrs[start_offset + log_pos].is_cursor_position); |