From f58a2580e0ea35d4b38f771f152215713fbd72b0 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 27 Sep 2014 18:58:37 +0100 Subject: 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. --- desktop/textarea.c | 14 ++++++++++++-- 1 file 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; -- cgit v1.2.3