From 5e01b6d663abc086847c9bec145edeb9cd91530a Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 8 Aug 2009 13:29:27 +0000 Subject: Change the way the grid is stored, previously it was: - a two-dimensional array of cells; - a two-dimensional array of utf8 data; - an array of line lengths. Now it is a single array of a new struct grid_line each of which represents a line and containts the length and an array of cells and an array of utf8 data. This will make it easier to add additional per-line members, such as flags. --- cmd-list-windows.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'cmd-list-windows.c') diff --git a/cmd-list-windows.c b/cmd-list-windows.c index 2e4932c3..e5a45be2 100644 --- a/cmd-list-windows.c +++ b/cmd-list-windows.c @@ -48,6 +48,7 @@ cmd_list_windows_exec(struct cmd *self, struct cmd_ctx *ctx) struct window *w; struct window_pane *wp; struct grid *gd; + struct grid_line *gl; u_int i; unsigned long long size; const char *name; @@ -65,11 +66,11 @@ cmd_list_windows_exec(struct cmd *self, struct cmd_ctx *ctx) size = 0; for (i = 0; i < gd->hsize; i++) { - size += gd->size[i] * sizeof **gd->data; - size += gd->usize[i] * sizeof **gd->udata; + gl = &gd->linedata[i]; + size += gl->cellsize * sizeof *gl->celldata; + size += gl->utf8size * sizeof *gl->utf8data; } - size += gd->hsize * (sizeof *gd->data); - size += gd->hsize * (sizeof *gd->size); + size += gd->hsize * sizeof *gd->linedata; if (wp->fd != -1) name = ttyname(wp->fd); -- cgit v1.2.3