From b37399304f9fa310d0790dee8a8325d79cc9af39 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 10 Feb 2009 00:18:06 +0000 Subject: 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. --- grid.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'grid.c') 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 @@ -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) -- cgit v1.2.3