screen: clear padding of main-lines on resize
authorDavid Herrmann <dh.herrmann@gmail.com>
Tue, 22 Oct 2013 14:28:02 +0000 (16:28 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Tue, 22 Oct 2013 14:28:02 +0000 (16:28 +0200)
The invisible padding during width reduction is not cleared as we clear
it when it gets visible again. However, if the line is pushed into
scrollback in between, it may get visible once the width is increases
again. Hence, clear padding of main-lines if screen-width is decreased.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
src/tsm_screen.c

index 26a8e4e..610172c 100644 (file)
@@ -635,19 +635,21 @@ int tsm_screen_resize(struct tsm_screen *con, unsigned int x,
                }
        }
 
-       /* clear expansion area */
+       /* clear expansion/padding area */
        for (j = 0; j < con->line_num; ++j) {
                i = 0;
                if (j < con->size_y)
                        i = con->size_x;
 
-               for ( ; i < x; ++i)
+               /* 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]);
 
                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]);
        }