From c8c48c4a22953c2da38e9947e56fbce0fde78cec Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 21 Jun 2014 22:52:01 +0200 Subject: Fix cursor moving --- src/wrap.c | 9 +++++++-- src/wrap.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/wrap.c b/src/wrap.c index 8c81295..b01fb82 100644 --- a/src/wrap.c +++ b/src/wrap.c @@ -119,7 +119,7 @@ static struct wrap_line *get_cursor_line(struct frame *fr, size_t pos, } #endif -void get_cursor_pos(struct wrap_box *box, size_t pos, +void get_cursor_pos(struct wrap_box *box, int pos, double *xposd, double *yposd, double *line_height) { int p; @@ -146,7 +146,7 @@ void get_cursor_pos(struct wrap_box *box, size_t pos, box_text = g_utf8_offset_to_pointer(block_text, box->offs_char); /* cast because this function is not const-clean */ pango_glyph_string_index_to_x(box->glyphs, (char *)box_text, - strlen(box_text), + box->item->length, &box->item->analysis, pos, FALSE, &p); *xposd += pango_units_to_double(p); @@ -158,6 +158,11 @@ void get_cursor_pos(struct wrap_box *box, size_t pos, } /* else zero */ break; + case WRAP_BOX_NOTHING : + case WRAP_BOX_SENTINEL : + *xposd = 0.0; + break; + } } diff --git a/src/wrap.h b/src/wrap.h index cb3b610..bd45aa8 100644 --- a/src/wrap.h +++ b/src/wrap.h @@ -102,7 +102,7 @@ struct wrap_line extern int wrap_contents(struct frame *fr); -extern void get_cursor_pos(struct wrap_box *box, size_t pos, +extern void get_cursor_pos(struct wrap_box *box, int pos, double *xposd, double *yposd, double *line_height); extern void move_cursor_back(struct presentation *p); -- cgit v1.2.3