From e6bf51c3ba29e9fea2a13be4365a4a2d68293ef3 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 11 Feb 2013 16:31:06 +0000 Subject: Single line textareas don't have scrollbars, so they don't get the scroll redraw request from the scrollbar callback. --- desktop/textarea.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'desktop') diff --git a/desktop/textarea.c b/desktop/textarea.c index f02ef3289..82a026188 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -310,7 +310,6 @@ static bool textarea_scroll_visible(struct textarea *ta) } else if (!(ta->flags & TEXTAREA_MULTILINE)) { ta->scroll_x = xs; scrolled = true; - } } @@ -1222,6 +1221,7 @@ bool textarea_set_caret(struct textarea *ta, int caret) int text_y_offset; int width, height; struct textarea_msg msg; + bool scrolled; if (ta->flags & TEXTAREA_READONLY) return true; @@ -1301,8 +1301,9 @@ bool textarea_set_caret(struct textarea *ta, int caret) y = ta->line_height * ta->caret_pos.line + text_y_offset; ta->caret_y = y; - if (!textarea_scroll_visible(ta) && - ta->flags & TEXTAREA_INTERNAL_CARET) { + scrolled = textarea_scroll_visible(ta); + + if (!scrolled && ta->flags & TEXTAREA_INTERNAL_CARET) { /* Didn't scroll, just moved caret. * Caret is internal caret, redraw it */ x -= ta->scroll_x; @@ -1326,6 +1327,18 @@ bool textarea_set_caret(struct textarea *ta, int caret) ta->callback(ta->data, &msg); } + } else if (scrolled && !(ta->flags & TEXTAREA_MULTILINE)) { + /* Textarea scrolled, whole area needs redraw */ + /* With multi-line textareas, the scrollbar + * callback will have requested redraw. */ + msg.ta = ta; + msg.type = TEXTAREA_MSG_REDRAW_REQUEST; + msg.data.redraw.x0 = 0; + msg.data.redraw.y0 = 0; + msg.data.redraw.x1 = ta->vis_width; + msg.data.redraw.y1 = ta->vis_height; + + ta->callback(ta->data, &msg); } if (!(ta->flags & TEXTAREA_INTERNAL_CARET)) { -- cgit v1.2.3