From a75acf2bb1ef843a47d0772f888a6a7a44f363a6 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 24 Sep 2017 16:18:48 +0200 Subject: Avoid looking up cursor position in non-text paragraph --- src/sc_editor.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/sc_editor.c b/src/sc_editor.c index ab98165..7fbf15e 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -490,14 +490,17 @@ static void draw_caret(cairo_t *cr, struct frame *fr, int cursor_para, return; } + assert(fr != NULL); + 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) ) - { + if ( para_type(para) != PARA_TYPE_TEXT ) { draw_para_highlight(cr, fr, cursor_para); return; } + offs = pos_trail_to_offset(para, cursor_pos, cursor_trail); + get_cursor_pos(fr, cursor_para, offs, &cx, &clow, &h); + cx += fr->x; clow += fr->y; chigh = clow + h; -- cgit v1.2.3