summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-10-23 20:20:16 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2013-10-23 20:20:16 +0200
commite6e0f6a4ca4df7cd5d6c5d4f3f87416c4af90a8d (patch)
treeeffe3f679b579cf609f27276b9968173fdb358fb
parent90bc3a9669daa926986c851668a92cc779fa76a5 (diff)
screen: implement proper ageing on screen resize
Screen-resize doesn't actually move any cells so it's fairly easy to age new cells. No need to redraw the whole buffer. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--src/tsm_screen.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/tsm_screen.c b/src/tsm_screen.c
index 24ffb56..f8e2b69 100644
--- a/src/tsm_screen.c
+++ b/src/tsm_screen.c
@@ -734,8 +734,6 @@ int tsm_screen_resize(struct tsm_screen *con, unsigned int x,
}
inc_age(con);
- /* TODO: more sophisticated ageing */
- con->age = con->age_cnt;
/* clear expansion/padding area */
start = x;
@@ -779,22 +777,22 @@ int tsm_screen_resize(struct tsm_screen *con, unsigned int x,
con->size_x = x;
if (con->cursor_x >= con->size_x)
- con->cursor_x = con->size_x - 1;
+ move_cursor(con, con->size_x - 1, con->cursor_y);
/* scroll buffer if screen height shrinks */
if (y < con->size_y) {
diff = con->size_y - y;
screen_scroll_up(con, diff);
if (con->cursor_y > diff)
- con->cursor_y -= diff;
+ move_cursor(con, con->cursor_x, con->cursor_y - diff);
else
- con->cursor_y = 0;
+ move_cursor(con, con->cursor_x, 0);
}
con->size_y = y;
con->margin_bottom = con->size_y - 1;
if (con->cursor_y >= con->size_y)
- con->cursor_y = con->size_y - 1;
+ move_cursor(con, con->cursor_x, con->size_y - 1);
return 0;
}