Fix handling of empty textarea.

This commit is contained in:
Michael Drake 2013-02-09 14:18:17 +00:00
parent 048b344a43
commit eb1113e4c3

View File

@ -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,6 +731,8 @@ 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] == ' ')