[BACK]Return to cmd-list-windows.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/cmd-list-windows.c between version 1.14 and 1.15

version 1.14, 2011/07/04 14:04:40 version 1.15, 2011/08/26 10:53:16
Line 28 
Line 28 
   
 int     cmd_list_windows_exec(struct cmd *, struct cmd_ctx *);  int     cmd_list_windows_exec(struct cmd *, struct cmd_ctx *);
   
 void    cmd_list_windows_server(struct cmd_ctx *);  void    cmd_list_windows_server(struct cmd *, struct cmd_ctx *);
 void    cmd_list_windows_session(struct session *, struct cmd_ctx *, int);  void    cmd_list_windows_session(
               struct cmd *, struct session *, struct cmd_ctx *, int);
   
 const struct cmd_entry cmd_list_windows_entry = {  const struct cmd_entry cmd_list_windows_entry = {
         "list-windows", "lsw",          "list-windows", "lsw",
         "at:", 0, 0,          "aF:t:", 0, 0,
         "[-a] " CMD_TARGET_SESSION_USAGE,          "[-a] [-F format] " CMD_TARGET_SESSION_USAGE,
         0,          0,
         NULL,          NULL,
         NULL,          NULL,
Line 48 
Line 49 
         struct session  *s;          struct session  *s;
   
         if (args_has(args, 'a'))          if (args_has(args, 'a'))
                 cmd_list_windows_server(ctx);                  cmd_list_windows_server(self, ctx);
         else {          else {
                 s = cmd_find_session(ctx, args_get(args, 't'), 0);                  s = cmd_find_session(ctx, args_get(args, 't'), 0);
                 if (s == NULL)                  if (s == NULL)
                         return (-1);                          return (-1);
                 cmd_list_windows_session(s, ctx, 0);                  cmd_list_windows_session(self, s, ctx, 0);
         }          }
   
         return (0);          return (0);
 }  }
   
 void  void
 cmd_list_windows_server(struct cmd_ctx *ctx)  cmd_list_windows_server(struct cmd *self, struct cmd_ctx *ctx)
 {  {
         struct session  *s;          struct session  *s;
   
         RB_FOREACH(s, sessions, &sessions)          RB_FOREACH(s, sessions, &sessions)
                 cmd_list_windows_session(s, ctx, 1);                  cmd_list_windows_session(self, s, ctx, 1);
 }  }
   
 void  void
 cmd_list_windows_session(struct session *s, struct cmd_ctx *ctx, int type)  cmd_list_windows_session(
       struct cmd *self, struct session *s, struct cmd_ctx *ctx, int type)
 {  {
         struct winlink  *wl;          struct args             *args = self->args;
         char            *layout;          struct winlink          *wl;
           u_int                   n;
           struct format_tree      *ft;
           const char              *template;
           char                    *line;
   
         RB_FOREACH(wl, winlinks, &s->windows) {          template = args_get(args, 'F');
                 layout = layout_dump(wl->window);          if (template == NULL) {
                 if (type) {                  switch (type) {
                         ctx->print(ctx, "%s:%d: %s [%ux%u] [layout %s]%s",                  case 0:
                             s->name, wl->idx, wl->window->name, wl->window->sx,                          template = "#{window_index}: "
                             wl->window->sy, layout,                              "#{window_name} "
                             wl == s->curw ? " (active)" : "");                              "[#{window_width}x#{window_height}] "
                 } else {                              "[layout #{window_layout}]"
                         ctx->print(ctx, "%d: %s [%ux%u] [layout %s]%s",                              "#{?window_active, (active),}";
                             wl->idx, wl->window->name, wl->window->sx,                          break;
                             wl->window->sy, layout,                  case 1:
                             wl == s->curw ? " (active)" : "");                          template = "#{session_name):#{window_index}: "
                               "#{window_name} "
                               "[#{window_width}x#{window_height}] "
                               "[layout #{window_layout}]"
                               "#{?window_active, (active),}";
                           break;
                 }                  }
                 xfree(layout);          }
   
           n = 0;
           RB_FOREACH(wl, winlinks, &s->windows) {
                   ft = format_create();
                   format_add(ft, "line", "%u", n);
                   format_session(ft, s);
                   format_winlink(ft, s, wl);
   
                   line = format_expand(ft, template);
                   ctx->print(ctx, "%s", line);
                   xfree(line);
   
                   format_free(ft);
                   n++;
         }          }
 }  }

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15