diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2014-09-27 18:58:37 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2014-09-27 18:58:37 +0100 |
commit | f58a2580e0ea35d4b38f771f152215713fbd72b0 (patch) | |
tree | 47967b7dfad528a142e0d24e143ee16d311943d1 | |
parent | c3d6099250475d40a8b5c9c548ac8858e9d7b5ac (diff) | |
download | netsurf-f58a2580e0ea35d4b38f771f152215713fbd72b0.tar.gz netsurf-f58a2580e0ea35d4b38f771f152215713fbd72b0.tar.bz2 |
Fix textarea wrap bug.
Was comparing against the current start line length, to decide if it
needed redrawing, without taking into account that old start line
might have been longer.
-rw-r--r-- | desktop/textarea.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/desktop/textarea.c b/desktop/textarea.c index 82f0989e5..d29e5f247 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -915,6 +915,7 @@ static bool textarea_reflow_multiline(struct textarea *ta, unsigned int len; unsigned int start; size_t b_off; + size_t b_start_line_end; int x; char *space, *para_end; unsigned int line; /* line count */ @@ -954,6 +955,9 @@ static bool textarea_reflow_multiline(struct textarea *ta, if (start != 0) start--; + /* Record original end pos of start line */ + b_start_line_end = ta->lines[start].b_start + ta->lines[start].b_length; + /* During layout we may decide we need to restart again from the * textarea's first line. */ do { @@ -1156,9 +1160,15 @@ static bool textarea_reflow_multiline(struct textarea *ta, ta->v_extent = v_extent; ta->line_count = line; + /* Update start line end byte pos, if it's increased */ + if (ta->lines[start].b_start + ta->lines[start].b_length > + b_start_line_end) { + b_start_line_end = ta->lines[start].b_start + + ta->lines[start].b_length; + } + /* Don't need to redraw above changes, so update redraw request rect */ - if (ta->lines[start].b_start + ta->lines[start].b_length < b_start && - restart == false) { + if (b_start_line_end < b_start && restart == false) { /* Start line is unchanged */ start++; skip_line = true; |