summaryrefslogtreecommitdiffstats
path: root/grid.c
diff options
context:
space:
mode:
authornicm <nicm>2020-05-16 14:53:23 +0000
committernicm <nicm>2020-05-16 14:53:23 +0000
commit5bf96c2f2c40e93b8e66d7100f7b3dc9074a1ca6 (patch)
treed8a716e90726e9b9b58d207836d697ba74840df2 /grid.c
parent428137d8765f6aeb56503d8d37e3b1c9b33994ce (diff)
Use a grid cell not a style for the pane style.
Diffstat (limited to 'grid.c')
-rw-r--r--grid.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/grid.c b/grid.c
index 0cef412b..81f3709c 100644
--- a/grid.c
+++ b/grid.c
@@ -211,19 +211,28 @@ grid_check_y(struct grid *gd, const char *from, u_int py)
return (0);
}
-/* Compare grid cells. Return 1 if equal, 0 if not. */
+/* Check if two styles are (visibly) the same. */
int
-grid_cells_equal(const struct grid_cell *gca, const struct grid_cell *gcb)
+grid_cells_look_equal(const struct grid_cell *gc1, const struct grid_cell *gc2)
{
- if (gca->fg != gcb->fg || gca->bg != gcb->bg)
+ if (gc1->fg != gc2->fg || gc1->bg != gc2->bg)
+ return (0);
+ if (gc1->attr != gc2->attr || gc1->flags != gc2->flags)
return (0);
- if (gca->attr != gcb->attr || gca->flags != gcb->flags)
+ return (1);
+}
+
+/* Compare grid cells. Return 1 if equal, 0 if not. */
+int
+grid_cells_equal(const struct grid_cell *gc1, const struct grid_cell *gc2)
+{
+ if (!grid_cells_look_equal(gc1, gc2))
return (0);
- if (gca->data.width != gcb->data.width)
+ if (gc1->data.width != gc2->data.width)
return (0);
- if (gca->data.size != gcb->data.size)
+ if (gc1->data.size != gc2->data.size)
return (0);
- return (memcmp(gca->data.data, gcb->data.data, gca->data.size) == 0);
+ return (memcmp(gc1->data.data, gc2->data.data, gc1->data.size) == 0);
}
/* Free one line. */