summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-11-12 20:56:40 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2013-11-12 20:56:40 +0100
commit92631710d4c8612c1d293fe442a898963f842de8 (patch)
tree1126ac9bae23e5c96b8907abdf5b071fff2dee06
parent4ce7e5b3397836320288e8c6dd38b54d73c6d860 (diff)
Revert "screen: remove empty cell fallback"
This reverts: commit 68e64ecf6d4a0b5d959962d875a97694b6abc23a Author: David Herrmann <dh.herrmann@gmail.com> Date: Tue Oct 22 15:53:31 2013 +0200 screen: remove empty cell fallback Our assumption was actually not true. If we render scrollback-buffer lines, we cannot assume that they are long enough. So add the dummy cell again and use it if a cell is not reachable. Note that we're safe removing the cursor-fallback, though (which was done in a follow up). Scroll-back buffers never contain the cursor so we're fine. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-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) {