aboutsummaryrefslogtreecommitdiff
path: root/grid.c
diff options
context:
space:
mode:
authornicm <nicm>2018-10-25 15:13:38 +0000
committernicm <nicm>2018-10-25 15:13:38 +0000
commitfc41bf46acaccb3da8d0588b7e1bbcfebc6442f6 (patch)
tree35eb7a9295fd36e29661b20a506551565ced9d16 /grid.c
parent9feb35b7c4007966bf19cdb57b904e373da2d247 (diff)
downloadrtmux-fc41bf46acaccb3da8d0588b7e1bbcfebc6442f6.tar.gz
rtmux-fc41bf46acaccb3da8d0588b7e1bbcfebc6442f6.tar.bz2
rtmux-fc41bf46acaccb3da8d0588b7e1bbcfebc6442f6.zip
Add a "terminal" colour which can be used instead of "default" in style
options for the terminal default colour, bypassing any inheritance from other options. Prompted by a discussion with abieber@.
Diffstat (limited to 'grid.c')
-rw-r--r--grid.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/grid.c b/grid.c
index a7c9a67e..7329f855 100644
--- a/grid.c
+++ b/grid.c
@@ -418,7 +418,7 @@ static void
grid_empty_line(struct grid *gd, u_int py, u_int bg)
{
memset(&gd->linedata[py], 0, sizeof gd->linedata[py]);
- if (bg != 8)
+ if (!COLOUR_DEFAULT(bg))
grid_expand_line(gd, py, gd->sx, bg);
}
@@ -524,7 +524,8 @@ grid_set_cells(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc,
void
grid_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny, u_int bg)
{
- u_int xx, yy;
+ struct grid_line *gl;
+ u_int xx, yy;
if (nx == 0 || ny == 0)
return;
@@ -540,12 +541,13 @@ grid_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny, u_int bg)
return;
for (yy = py; yy < py + ny; yy++) {
- if (px + nx >= gd->sx && px < gd->linedata[yy].cellused)
- gd->linedata[yy].cellused = px;
- if (px > gd->linedata[yy].cellsize && bg == 8)
+ gl = &gd->linedata[yy];
+ if (px + nx >= gd->sx && px < gl->cellused)
+ gl->cellused = px;
+ if (px > gl->cellsize && COLOUR_DEFAULT(bg))
continue;
- if (px + nx >= gd->linedata[yy].cellsize && bg == 8) {
- gd->linedata[yy].cellsize = px;
+ if (px + nx >= gl->cellsize && COLOUR_DEFAULT(bg)) {
+ gl->cellsize = px;
continue;
}
grid_expand_line(gd, yy, px + nx, 8); /* default bg first */