diff options
author | 2020-06-02 20:51:46 +0000 | |
---|---|---|
committer | 2020-06-02 20:51:46 +0000 | |
commit | 71a06389cdece4bcda2807a1b6f9f33b67c1b38a (patch) | |
tree | 9d31d6e8a0e68ef702e2dd0c2144a90d770783af /usr.bin/tmux/grid.c | |
parent | Allow UTF-8 characters of width 0 to be stored, it is useful to be able (diff) | |
download | wireguard-openbsd-71a06389cdece4bcda2807a1b6f9f33b67c1b38a.tar.xz wireguard-openbsd-71a06389cdece4bcda2807a1b6f9f33b67c1b38a.zip |
Move the code to set up a padding cell into grid.c.
Diffstat (limited to 'usr.bin/tmux/grid.c')
-rw-r--r-- | usr.bin/tmux/grid.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c index a16b004502a..c095463dc96 100644 --- a/usr.bin/tmux/grid.c +++ b/usr.bin/tmux/grid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grid.c,v 1.115 2020/06/02 20:10:23 nicm Exp $ */ +/* $OpenBSD: grid.c,v 1.116 2020/06/02 20:51:46 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -40,8 +40,16 @@ const struct grid_cell grid_default_cell = { { { ' ' }, 0, 1, 1 }, 0, 0, 8, 8, 0 }; +/* + * Padding grid cell data. Padding cells are the only zero width cell that + * appears in the grid - because of this, they are always extended cells. + */ +static const struct grid_cell grid_padding_cell = { + { { '!' }, 0, 0, 0 }, 0, GRID_FLAG_PADDING, 8, 8, 0 +}; + /* Cleared grid cell data. */ -const struct grid_cell grid_cleared_cell = { +static const struct grid_cell grid_cleared_cell = { { { ' ' }, 0, 1, 1 }, 0, GRID_FLAG_CLEARED, 8, 8, 0 }; static const struct grid_cell_entry grid_cleared_entry = { @@ -524,7 +532,7 @@ grid_get_cell(struct grid *gd, u_int px, u_int py, struct grid_cell *gc) grid_get_cell1(&gd->linedata[py], px, gc); } -/* Set cell at relative position. */ +/* Set cell at position. */ void grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc) { @@ -547,7 +555,14 @@ grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc) grid_store_cell(gce, gc, gc->data.data[0]); } -/* Set cells at relative position. */ +/* Set padding at position. */ +void +grid_set_padding(struct grid *gd, u_int px, u_int py) +{ + grid_set_cell(gd, px, py, &grid_padding_cell); +} + +/* Set cells at position. */ void grid_set_cells(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc, const char *s, size_t slen) |