diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2013-02-11 16:31:06 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2013-02-11 16:31:06 +0000 |
commit | e6bf51c3ba29e9fea2a13be4365a4a2d68293ef3 (patch) | |
tree | 7919c77078aa0191508a90e6e7893c2da0e8504e | |
parent | 3bcc79ccf044e08dae4285229f62ad5329059ab6 (diff) | |
download | netsurf-e6bf51c3ba29e9fea2a13be4365a4a2d68293ef3.tar.gz netsurf-e6bf51c3ba29e9fea2a13be4365a4a2d68293ef3.tar.bz2 |
Single line textareas don't have scrollbars, so they don't get the scroll redraw request from the scrollbar callback.
-rw-r--r-- | desktop/textarea.c | 19 |
1 files changed, 16 insertions, 3 deletions
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)) { |