summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/grid.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2016-01-29 11:13:56 +0000
committernicm <nicm@openbsd.org>2016-01-29 11:13:56 +0000
commita4f3e970c6385ca97289df21380e5cb5a6c2a04d (patch)
tree3b58baceee5bc02085ba0627e76cd4e870249c16 /usr.bin/tmux/grid.c
parentSimplify code: hasrun is confusing and useless. There is no way (diff)
downloadwireguard-openbsd-a4f3e970c6385ca97289df21380e5cb5a6c2a04d.tar.xz
wireguard-openbsd-a4f3e970c6385ca97289df21380e5cb5a6c2a04d.zip
Support for RGB colour, using the extended cell mechanism to avoid
wasting unnecessary space. The 'Tc' flag must be set in the external TERM entry (using terminal-overrides or a custom terminfo entry), if not tmux will map to the closest of the 256 or 16 colour palettes. Mostly from Suraj N Kurapati, based on a diff originally by someone else.
Diffstat (limited to 'usr.bin/tmux/grid.c')
-rw-r--r--usr.bin/tmux/grid.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c
index 3d40eebb7ba..642593b5ae9 100644
--- a/usr.bin/tmux/grid.c
+++ b/usr.bin/tmux/grid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grid.c,v 1.50 2016/01/19 15:59:12 nicm Exp $ */
+/* $OpenBSD: grid.c,v 1.51 2016/01/29 11:13:56 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -37,7 +37,7 @@
/* Default grid cell data. */
const struct grid_cell grid_default_cell = {
- 0, 0, 8, 8, { { ' ' }, 0, 1, 1 }
+ 0, 0, { .fg = 8 }, { .bg = 8 }, { { ' ' }, 0, 1, 1 }
};
const struct grid_cell_entry grid_default_entry = {
0, { .data = { 0, 8, 8, ' ' } }
@@ -284,6 +284,7 @@ grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
struct grid_line *gl;
struct grid_cell_entry *gce;
struct grid_cell *gcp;
+ int extended;
if (grid_check_y(gd, py) != 0)
return;
@@ -293,8 +294,12 @@ grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
gl = &gd->linedata[py];
gce = &gl->celldata[px];
- if ((gce->flags & GRID_FLAG_EXTENDED) || gc->data.size != 1 ||
- gc->data.width != 1) {
+ extended = (gce->flags & GRID_FLAG_EXTENDED);
+ if (!extended && (gc->data.size != 1 || gc->data.width != 1))
+ extended = 1;
+ if (!extended && (gc->flags & (GRID_FLAG_FGRGB|GRID_FLAG_BGRGB)))
+ extended = 1;
+ if (extended) {
if (~gce->flags & GRID_FLAG_EXTENDED) {
gl->extddata = xreallocarray(gl->extddata,
gl->extdsize + 1, sizeof *gl->extddata);