summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-02-09 14:18:17 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-02-09 14:18:17 +0000
commiteb1113e4c3e3b2092e27ab94095b517929a65d1e (patch)
tree88a7f53b6817d064f6f7b6c2f4cb55da8669020c
parent048b344a438dba1ff588c7a6fb3f9b67a1c7561e (diff)
downloadnetsurf-eb1113e4c3e3b2092e27ab94095b517929a65d1e.tar.gz
netsurf-eb1113e4c3e3b2092e27ab94095b517929a65d1e.tar.bz2
Fix handling of empty textarea.
-rw-r--r--desktop/textarea.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/desktop/textarea.c b/desktop/textarea.c
index 9ba5f1e65..92f1acd29 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -528,7 +528,7 @@ static bool textarea_reflow(struct textarea *ta, unsigned int start)
/* Handle empty textarea */
assert(ta->text.data[0] == '\0');
ta->lines[line].b_start = 0;
- ta->lines[line++].b_length = 1;
+ ta->lines[line++].b_length = 0;
}
restart = false;
@@ -731,9 +731,11 @@ static void textarea_get_xy_offset(struct textarea *ta, int x, int y,
* following line, which is undesirable.
*/
if (ta->flags & TEXTAREA_MULTILINE &&
+ ta->show->data[ta->lines[line].b_start +
+ ta->lines[line].b_length] > 0 &&
bpos == (unsigned)ta->lines[line].b_length &&
ta->show->data[ta->lines[line].b_start +
- ta->lines[line].b_length - 1] == ' ')
+ ta->lines[line].b_length - 1] == ' ')
bpos--;
/* Get character position */