summaryrefslogtreecommitdiffstats
path: root/grid.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-02-10 00:18:06 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-02-10 00:18:06 +0000
commitb37399304f9fa310d0790dee8a8325d79cc9af39 (patch)
tree789d0aa5aaa2ebc4999941f7470873d8aa333c01 /grid.c
parentcc5a0ab0e427a47c4f5f95d6f6b257c7589f2b42 (diff)
Don't redraw status line unless it has actually changed. Stops extraneous
updates between clock/#() changes and doesn't require manual status-interval 0 when no updates are occuring.
Diffstat (limited to 'grid.c')
-rw-r--r--grid.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/grid.c b/grid.c
index 714721da..4bb17cf6 100644
--- a/grid.c
+++ b/grid.c
@@ -1,4 +1,4 @@
-/* $Id: grid.c,v 1.7 2009-01-17 18:47:36 nicm Exp $ */
+/* $Id: grid.c,v 1.8 2009-02-10 00:18:06 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -119,6 +119,30 @@ grid_destroy(struct grid_data *gd)
xfree(gd);
}
+/* Compare grids. */
+int
+grid_compare(struct grid_data *ga, struct grid_data *gb)
+{
+ struct grid_cell *gca, *gcb;
+ u_int xx, yy;
+
+ if (ga->sx != gb->sx || ga->sy != ga->sy)
+ return (1);
+
+ for (yy = 0; yy < ga->sy; yy++) {
+ if (ga->size[yy] != gb->size[yy])
+ return (1);
+ for (xx = 0; xx < ga->sx; xx++) {
+ gca = &ga->data[yy][xx];
+ gcb = &gb->data[yy][xx];
+ if (memcmp(gca, gcb, sizeof (struct grid_cell)) != 0)
+ return (1);
+ }
+ }
+
+ return (0);
+}
+
/* Scroll a line into the history. */
void
grid_scroll_line(struct grid_data *gd)