Revision: 2545
          http://tmux.svn.sourceforge.net/tmux/?rev=2545&view=rev
Author:   tcunha
Date:     2011-07-05 10:43:59 +0000 (Tue, 05 Jul 2011)

Log Message:
-----------
Sync OpenBSD patchset 932:

Show full targets for lsp/lsw -a.

Modified Paths:
--------------
    trunk/cmd-list-panes.c
    trunk/cmd-list-windows.c

Modified: trunk/cmd-list-panes.c
===================================================================
--- trunk/cmd-list-panes.c      2011-07-05 10:42:09 UTC (rev 2544)
+++ trunk/cmd-list-panes.c      2011-07-05 10:43:59 UTC (rev 2545)
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-panes.c,v 1.10 2011-04-06 22:24:00 nicm Exp $ */
+/* $Id$ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -29,8 +29,9 @@
 int    cmd_list_panes_exec(struct cmd *, struct cmd_ctx *);
 
 void   cmd_list_panes_server(struct cmd_ctx *);
-void   cmd_list_panes_session(struct session *, struct cmd_ctx *);
-void   cmd_list_panes_window(struct winlink *, struct cmd_ctx *);
+void   cmd_list_panes_session(struct session *, struct cmd_ctx *, int);
+void   cmd_list_panes_window(
+           struct session *, struct winlink *, struct cmd_ctx *, int);
 
 const struct cmd_entry cmd_list_panes_entry = {
        "list-panes", "lsp",
@@ -55,12 +56,12 @@
                s = cmd_find_session(ctx, args_get(args, 't'), 0);
                if (s == NULL)
                        return (-1);
-               cmd_list_panes_session(s, ctx);
+               cmd_list_panes_session(s, ctx, 1);
        } else {
-               wl = cmd_find_window(ctx, args_get(args, 't'), NULL);
+               wl = cmd_find_window(ctx, args_get(args, 't'), &s);
                if (wl == NULL)
                        return (-1);
-               cmd_list_panes_window(wl, ctx);
+               cmd_list_panes_window(s, wl, ctx, 0);
        }
 
        return (0);
@@ -72,20 +73,21 @@
        struct session  *s;
 
        RB_FOREACH(s, sessions, &sessions)
-               cmd_list_panes_session(s, ctx);
+               cmd_list_panes_session(s, ctx, 2);
 }
 
 void
-cmd_list_panes_session(struct session *s, struct cmd_ctx *ctx)
+cmd_list_panes_session(struct session *s, struct cmd_ctx *ctx, int type)
 {
        struct winlink  *wl;
 
        RB_FOREACH(wl, winlinks, &s->windows)
-               cmd_list_panes_window(wl, ctx);
+               cmd_list_panes_window(s, wl, ctx, type);
 }
 
 void
-cmd_list_panes_window(struct winlink *wl, struct cmd_ctx *ctx)
+cmd_list_panes_window(
+    struct session *s, struct winlink *wl, struct cmd_ctx *ctx, int type)
 {
        struct window_pane      *wp;
        struct grid             *gd;
@@ -105,11 +107,31 @@
                }
                size += gd->hsize * sizeof *gd->linedata;
 
-               ctx->print(ctx,
-                   "%u: [%ux%u] [history %u/%u, %llu bytes] %%%u%s%s",
-                   n, wp->sx, wp->sy, gd->hsize, gd->hlimit, size, wp->id,
-                   wp == wp->window->active ? " (active)" : "",
-                   wp->fd == -1 ? " (dead)" : "");
+               switch (type) {
+               case 0:
+                       ctx->print(ctx,
+                           "%u: [%ux%u] [history %u/%u, %llu bytes] %%%u%s%s",
+                           n, wp->sx, wp->sy, gd->hsize, gd->hlimit, size,
+                           wp->id, wp == wp->window->active ? " (active)" : "",
+                           wp->fd == -1 ? " (dead)" : "");
+                       break;
+               case 1:
+                       ctx->print(ctx,
+                           "%d.%u: [%ux%u] [history %u/%u, %llu bytes] "
+                           "%%%u%s%s", wl->idx,
+                           n, wp->sx, wp->sy, gd->hsize, gd->hlimit, size,
+                           wp->id, wp == wp->window->active ? " (active)" : "",
+                           wp->fd == -1 ? " (dead)" : "");
+                       break;
+               case 2:
+                       ctx->print(ctx,
+                           "%s:%d.%u: [%ux%u] [history %u/%u, %llu bytes] "
+                           "%%%u%s%s", s->name, wl->idx,
+                           n, wp->sx, wp->sy, gd->hsize, gd->hlimit, size,
+                           wp->id, wp == wp->window->active ? " (active)" : "",
+                           wp->fd == -1 ? " (dead)" : "");
+                       break;
+               }
                n++;
        }
 }

Modified: trunk/cmd-list-windows.c
===================================================================
--- trunk/cmd-list-windows.c    2011-07-05 10:42:09 UTC (rev 2544)
+++ trunk/cmd-list-windows.c    2011-07-05 10:43:59 UTC (rev 2545)
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-windows.c,v 1.47 2011-04-06 22:24:00 nicm Exp $ */
+/* $Id$ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -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 @@
                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 @@
        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);
        }
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to