From e79c7d2ce81683f83c03b07dca4762282031bb51 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 29 Nov 2011 10:40:30 +0000 Subject: Fix caret position after deleting selection. Thanks to Ole Loots. svn path=/trunk/netsurf/; revision=13193 --- desktop/textarea.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'desktop') diff --git a/desktop/textarea.c b/desktop/textarea.c index 1e94c7f1b..efa5ed24e 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -66,7 +66,7 @@ struct line_info { }; struct text_area { - + int scroll_x, scroll_y; /**< scroll offsets of the textarea * content */ @@ -726,7 +726,7 @@ bool textarea_reflow(struct text_area *ta, unsigned int line) * \param y1 bottom Y coordinate of redraw area * \param ctx current redraw context */ -void textarea_redraw(struct text_area *ta, int x, int y, +void textarea_redraw(struct text_area *ta, int x, int y, const struct rect *clip, const struct redraw_context *ctx) { const struct plotter_table *plot = ctx->plot; @@ -961,6 +961,8 @@ bool textarea_keypress(struct text_area *ta, uint32_t key) ta->selection_start, ta->selection_end, "")) return false; + + caret = ta->selection_start; ta->selection_start = ta->selection_end = -1; redraw = true; } else { @@ -1124,6 +1126,7 @@ bool textarea_keypress(struct text_area *ta, uint32_t key) ta->selection_end, "")) return false; + caret = ta->selection_start; ta->selection_start = ta->selection_end = -1; redraw = true; } else { @@ -1446,7 +1449,7 @@ void textarea_get_dimensions(struct text_area *ta, int *width, int *height) } /** - * Set the dimensions of a textarea, causing a reflow and + * Set the dimensions of a textarea, causing a reflow and * emitting a redraw request. * * \param width the new width of the textarea -- cgit v1.2.3