aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-09-24 15:55:42 +0200
committerThomas White <taw@physics.org>2017-09-24 15:55:42 +0200
commit52cd25911771026154bb1e8120b58b1bdaa9a4bf (patch)
tree3c1a2ed23a737f23ae0cccb460be69484329a563 /src
parent36ac3999213068880ae7ff149a3f621fd70389b6 (diff)
draw_caret(): Use pos_trail_to_offset()
Diffstat (limited to 'src')
-rw-r--r--src/sc_editor.c7
1 files changed, 5 insertions, 2 deletions
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;