summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-list-windows.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-08-08 13:29:28 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-08-08 13:29:28 +0000
commit68a547dbfae9686014f193330dae19d80e7a5d45 (patch)
tree7a5478728669f1f5a9933edb76821dfe3a1a091b /usr.bin/tmux/cmd-list-windows.c
parentfed9693c023d5581d4dfe78092fdce91d555e2b3 (diff)
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.
Diffstat (limited to 'usr.bin/tmux/cmd-list-windows.c')
-rw-r--r--usr.bin/tmux/cmd-list-windows.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/tmux/cmd-list-windows.c b/usr.bin/tmux/cmd-list-windows.c
index 9802eb2110c..4a0c38b6cdb 100644
--- a/usr.bin/tmux/cmd-list-windows.c
+++ b/usr.bin/tmux/cmd-list-windows.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-list-windows.c,v 1.4 2009/07/26 12:58:44 nicm Exp $ */
+/* $OpenBSD: cmd-list-windows.c,v 1.5 2009/08/08 13:29:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);