From 700aea8b08c565926e35d1816ad8a1db36f1462c Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 14 Jan 2013 11:46:56 +0000 Subject: Fix caret removal redraw to take account of border width. Fix scroll_visible to take account of border width in vertical scroll. --- desktop/textarea.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'desktop') diff --git a/desktop/textarea.c b/desktop/textarea.c index 94d9b96c1..3241cf9d3 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -237,7 +237,7 @@ static bool textarea_scroll_visible(struct textarea *ta) x0 = ta->border_width + ta->pad_left; x1 = ta->vis_width - (ta->border_width + ta->pad_left); y0 = 0; - y1 = ta->vis_height; + y1 = ta->vis_height - 2 * ta->border_width; x = ta->caret_x - ta->scroll_x; y = ta->caret_y - ta->scroll_y; @@ -754,13 +754,14 @@ bool textarea_set_caret(struct textarea *ta, int caret) text_y_offset = ta->border_width + ta->pad_top; } else { /* Single line text area; text is vertically centered */ - text_y_offset = (ta->vis_height - ta->line_height + 1) / 2; + text_y_offset = ta->border_width; + text_y_offset += (ta->vis_height - ta->line_height + 1) / 2; } /* Delete the old caret */ if (ta->caret_pos.char_off != -1) { x0 = ta->caret_x - ta->scroll_x; - y0 = ta->caret_y - ta->scroll_y; + y0 = ta->caret_y + text_y_offset - ta->scroll_y; width = 2; height = ta->line_height; -- cgit v1.2.3