summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/grid.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2018-10-25 15:13:39 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2018-10-25 15:13:39 +0000
commit5650c2b39286b57f4f4c47f76527367cf5066e27 (patch)
tree8d857f06e204b9edfe43f54109f0450216315ee4 /usr.bin/tmux/grid.c
parentb6e37a7900023f8d0e428855a7979ad75542dc89 (diff)
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 'usr.bin/tmux/grid.c')
-rw-r--r--usr.bin/tmux/grid.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c
index 36237865048..ef8d25550f6 100644
--- a/usr.bin/tmux/grid.c
+++ b/usr.bin/tmux/grid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grid.c,v 1.87 2018/10/18 07:57:57 nicm Exp $ */
+/* $OpenBSD: grid.c,v 1.88 2018/10/25 15:13:38 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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 */