diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-10-23 20:07:45 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2013-10-23 20:07:45 +0200 |
commit | 90bc3a9669daa926986c851668a92cc779fa76a5 (patch) | |
tree | fcec4a1e7fa542cb6534a05a6c317bf3f0491949 | |
parent | 0761efaf48aa1ba9e9be58d2d50982438075d9c7 (diff) |
screen: clear existing cells when shrinking
Clear parts of the existing screen if it is about to get hidden.
Otherwise, it might reach the scrollback later when it is no longer part
of the line it was during resize.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r-- | src/tsm_screen.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/tsm_screen.c b/src/tsm_screen.c index 634e004..24ffb56 100644 --- a/src/tsm_screen.c +++ b/src/tsm_screen.c @@ -654,7 +654,7 @@ int tsm_screen_resize(struct tsm_screen *con, unsigned int x, unsigned int y) { struct line **cache; - unsigned int i, j, width, diff; + unsigned int i, j, width, diff, start; int ret; bool *tab_ruler; @@ -738,20 +738,23 @@ int tsm_screen_resize(struct tsm_screen *con, unsigned int x, con->age = con->age_cnt; /* clear expansion/padding area */ + start = x; + if (x > con->size_x) + start = con->size_x; for (j = 0; j < con->line_num; ++j) { + /* main-lines may go into SB, so clear all cells */ i = 0; if (j < con->size_y) - i = con->size_x; + i = start; - /* main-lines may go into SB, so clear all cells */ for ( ; i < con->main_lines[j]->size; ++i) cell_init(con, &con->main_lines[j]->cells[i]); + /* alt-lines never go into SB, only clear visible cells */ i = 0; if (j < con->size_y) i = con->size_x; - /* alt-lines never go into SB, only clear visible cells */ for ( ; i < x; ++i) cell_init(con, &con->alt_lines[j]->cells[i]); } |