From 5650c2b39286b57f4f4c47f76527367cf5066e27 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 25 Oct 2018 15:13:39 +0000 Subject: 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@. --- usr.bin/tmux/grid.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'usr.bin/tmux/grid.c') 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 @@ -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 */ -- cgit v1.2.3