diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2013-05-15 15:39:51 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2013-05-15 15:39:51 +0000 |
commit | 88a4da97478ec6b4b2f361315a5a183333d0aa3f (patch) | |
tree | eb7a7b0b4ad724c0bc6475c884e09242ce9b3178 /screen.c | |
parent | 25c430b1cd25d64c52d1c14834957abfaaeb69b6 (diff) |
Don't let cursor position overflow when reflowing, from Christopher
Collins.
Diffstat (limited to 'screen.c')
-rw-r--r-- | screen.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -365,7 +365,13 @@ void screen_reflow(struct screen *s, u_int new_x) { struct grid *old = s->grid; + u_int change; s->grid = grid_create(old->sx, old->sy, old->hlimit); - s->cy -= grid_reflow(s->grid, old, new_x); + + change = grid_reflow(s->grid, old, new_x); + if (change < s->cy) + s->cy -= change; + else + s->cy = 0; } |