summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tsm_screen.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/tsm_screen.c b/src/tsm_screen.c
index 982f9b6..bb75a7c 100644
--- a/src/tsm_screen.c
+++ b/src/tsm_screen.c
@@ -2013,7 +2013,7 @@ tsm_age_t tsm_screen_draw(struct tsm_screen *con, tsm_screen_draw_cb draw_cb,
unsigned int cur_x, cur_y;
unsigned int i, j, k;
struct line *iter, *line = NULL;
- struct cell *cell;
+ struct cell *cell, empty;
struct tsm_screen_attr attr;
int ret, warned = 0;
const uint32_t *ch;
@@ -2025,6 +2025,8 @@ tsm_age_t tsm_screen_draw(struct tsm_screen *con, tsm_screen_draw_cb draw_cb,
if (!con || !draw_cb)
return 0;
+ cell_init(con, &empty);
+
cur_x = con->cursor_x;
if (con->cursor_x >= con->size_x)
cur_x = con->size_x - 1;
@@ -2078,7 +2080,11 @@ tsm_age_t tsm_screen_draw(struct tsm_screen *con, tsm_screen_draw_cb draw_cb,
}
for (j = 0; j < con->size_x; ++j) {
- cell = &line->cells[j];
+ if (j < line->size)
+ cell = &line->cells[j];
+ else
+ cell = &empty;
+
memcpy(&attr, &cell->attr, sizeof(attr));
if (con->sel_active) {