aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-02 20:32:25 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-02 20:32:25 +0000
commitdfaa5f56407f4035dcae6445ed5ffec52782258c (patch)
treeaf9d64524bdf6603d7c9e2001a8c1b2b6b0cd0c1 /main.c
parentrender: track last cursor position in absolute values (diff)
main: make sure cursor is inside the new row/col limits on resize
Diffstat (limited to 'main.c')
-rw-r--r--main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/main.c b/main.c
index 24371687..b82fa7a7 100644
--- a/main.c
+++ b/main.c
@@ -546,6 +546,11 @@ resize(struct context *c, int width, int height)
if (c->term.scroll_region.end == old_rows)
c->term.scroll_region.end = c->term.rows;
+ term_cursor_to(
+ &c->term,
+ min(c->term.cursor.row, c->term.rows),
+ min(c->term.cursor.col, c->term.cols));
+
term_damage_all(&c->term);
if (!c->frame_is_scheduled)