summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'desktop')
-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 */