From 52cd25911771026154bb1e8120b58b1bdaa9a4bf Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 24 Sep 2017 15:55:42 +0200 Subject: draw_caret(): Use pos_trail_to_offset() --- src/sc_editor.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sc_editor.c b/src/sc_editor.c index 5cc612e..ab98165 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -482,14 +482,17 @@ static void draw_caret(cairo_t *cr, struct frame *fr, int cursor_para, { double cx, clow, chigh, h; const double t = 1.8; + size_t offs; + Paragraph *para; if ( hgh ) { draw_para_highlight(cr, fr, cursor_para); return; } - if ( get_cursor_pos(fr, cursor_para, cursor_pos+cursor_trail, - &cx, &clow, &h) ) + para = fr->paras[cursor_para]; + offs = pos_trail_to_offset(para, cursor_pos, cursor_trail); + if ( get_cursor_pos(fr, cursor_para, offs, &cx, &clow, &h) ) { draw_para_highlight(cr, fr, cursor_para); return; -- cgit v1.2.3