mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-14 07:49:01 +02:00
Reorg window data structures. Add an intermediate data type (struct winlink) to hold index and make sessions hold a RB tree of them rather than a fixed array.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-list-windows.c,v 1.3 2007-10-23 09:36:07 nicm Exp $ */
|
||||
/* $Id: cmd-list-windows.c,v 1.4 2007-10-26 12:29:07 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -44,17 +44,14 @@ cmd_list_windows_exec(unused void *ptr, struct cmd_ctx *ctx)
|
||||
{
|
||||
struct client *c = ctx->client;
|
||||
struct session *s = ctx->session;
|
||||
struct winlink *wl;
|
||||
struct window *w;
|
||||
u_int i;
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(&s->windows); i++) {
|
||||
w = ARRAY_ITEM(&s->windows, i);
|
||||
if (w == NULL)
|
||||
continue;
|
||||
|
||||
ctx->print(ctx,
|
||||
"%u: %s \"%s\" (%s) [%ux%u]", i, w->name, w->screen.title,
|
||||
ttyname(w->fd), w->screen.sx, w->screen.sy);
|
||||
RB_FOREACH(wl, winlinks, &s->windows) {
|
||||
w = wl->window;
|
||||
ctx->print(ctx, "%u: %s \"%s\" (%s) [%ux%u]", wl->idx,
|
||||
w->name, w->screen.title, ttyname(w->fd),
|
||||
w->screen.sx, w->screen.sy);
|
||||
}
|
||||
|
||||
if (!(ctx->flags & CMD_KEY))
|
||||
|
Reference in New Issue
Block a user