aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2014-06-21 22:52:01 +0200
committerThomas White <taw@bitwiz.org.uk>2014-06-21 22:52:01 +0200
commitc8c48c4a22953c2da38e9947e56fbce0fde78cec (patch)
tree7404a476893cf514d0e89e60d68c9a5e2a13c1dc /src
parent10d05eeeb2705c3918e27a98253e95a2d50fe189 (diff)
Fix cursor moving
Diffstat (limited to 'src')
-rw-r--r--src/wrap.c9
-rw-r--r--src/wrap.h2
2 files changed, 8 insertions, 3 deletions
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);