summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-list-windows.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2011-07-04 14:04:41 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2011-07-04 14:04:41 +0000
commit234f91e8668b168257adc7ec941db7203537fe56 (patch)
treed88b91f265c9e09902d81e8948ae3cc5bd06ca8d /usr.bin/tmux/cmd-list-windows.c
parent30181515b59fc24635ef46cf7f54c5f5c06917a9 (diff)
Show full targets for lsp/lsw -a.
Diffstat (limited to 'usr.bin/tmux/cmd-list-windows.c')
-rw-r--r--usr.bin/tmux/cmd-list-windows.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-list-windows.c b/usr.bin/tmux/cmd-list-windows.c
index 266fc4d22cf..0a71bff2c9b 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.13 2011/04/05 19:37:01 nicm Exp $ */
+/* $OpenBSD: cmd-list-windows.c,v 1.14 2011/07/04 14:04:40 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -29,7 +29,7 @@
int cmd_list_windows_exec(struct cmd *, struct cmd_ctx *);
void cmd_list_windows_server(struct cmd_ctx *);
-void cmd_list_windows_session(struct session *, struct cmd_ctx *);
+void cmd_list_windows_session(struct session *, struct cmd_ctx *, int);
const struct cmd_entry cmd_list_windows_entry = {
"list-windows", "lsw",
@@ -53,7 +53,7 @@ cmd_list_windows_exec(struct cmd *self, struct cmd_ctx *ctx)
s = cmd_find_session(ctx, args_get(args, 't'), 0);
if (s == NULL)
return (-1);
- cmd_list_windows_session(s, ctx);
+ cmd_list_windows_session(s, ctx, 0);
}
return (0);
@@ -65,20 +65,28 @@ cmd_list_windows_server(struct cmd_ctx *ctx)
struct session *s;
RB_FOREACH(s, sessions, &sessions)
- cmd_list_windows_session(s, ctx);
+ cmd_list_windows_session(s, ctx, 1);
}
void
-cmd_list_windows_session(struct session *s, struct cmd_ctx *ctx)
+cmd_list_windows_session(struct session *s, struct cmd_ctx *ctx, int type)
{
struct winlink *wl;
char *layout;
RB_FOREACH(wl, winlinks, &s->windows) {
layout = layout_dump(wl->window);
- ctx->print(ctx, "%d: %s [%ux%u] [layout %s]%s",
- wl->idx, wl->window->name, wl->window->sx, wl->window->sy,
- layout, wl == s->curw ? " (active)" : "");
+ if (type) {
+ ctx->print(ctx, "%s:%d: %s [%ux%u] [layout %s]%s",
+ s->name, wl->idx, wl->window->name, wl->window->sx,
+ wl->window->sy, layout,
+ wl == s->curw ? " (active)" : "");
+ } else {
+ ctx->print(ctx, "%d: %s [%ux%u] [layout %s]%s",
+ wl->idx, wl->window->name, wl->window->sx,
+ wl->window->sy, layout,
+ wl == s->curw ? " (active)" : "");
+ }
xfree(layout);
}
}