aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-06-26 17:44:31 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-06-26 17:44:31 +0000
commit3a97fce6d06dea35211191237a6ad3c2d41e5d31 (patch)
tree0ed6a0ec8928ca1cbb8332dc2ea44f7e1bcf87ab /main.c
parentscroll: let the render erase the scrolled up region (diff)
grid: attributes now track whether we've set a foreground/background color
This means we don't have to explicitly set the foreground/background to the grid's default colors whenever we reset/clear a cell, and we can instead simply memset() the entire cell to 0. This also means the renderer has to get the default color when rendering a cell without a foreground/background color set.
Diffstat (limited to 'main.c')
-rw-r--r--main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/main.c b/main.c
index 781db37b..ec951f9b 100644
--- a/main.c
+++ b/main.c
@@ -102,8 +102,10 @@ grid_render_update(struct context *c, struct buffer *buf, const struct damage *d
int width = c->term.grid.cell_width;
int height = c->term.grid.cell_height;
- uint32_t foreground = cell->attrs.foreground;
- uint32_t background = cell->attrs.background;
+ uint32_t foreground = cell->attrs.have_foreground
+ ? cell->attrs.foreground : c->term.grid.foreground;
+ uint32_t background = cell->attrs.have_background
+ ? cell->attrs.background : c->term.grid.background;
if (has_cursor) {
uint32_t swap = foreground;