diff options
author | Thomas White <taw@physics.org> | 2017-09-24 16:18:48 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2017-09-24 16:18:48 +0200 |
commit | a75acf2bb1ef843a47d0772f888a6a7a44f363a6 (patch) | |
tree | f2bd082d0726b2943b830fda06033798fe8a0234 /src | |
parent | cad14605d955ce5f0875d42e4860d0e43ef79afe (diff) |
Avoid looking up cursor position in non-text paragraph
Diffstat (limited to 'src')
-rw-r--r-- | src/sc_editor.c | 9 |
1 files changed, 6 insertions, 3 deletions
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; |