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

Diff for /src/usr.bin/tmux/Attic/cmd-choose-session.c between version 1.14 and 1.15

version 1.14, 2012/06/25 14:08:55 version 1.15, 2012/06/25 14:27:25
Line 45 
Line 45 
 cmd_choose_session_exec(struct cmd *self, struct cmd_ctx *ctx)  cmd_choose_session_exec(struct cmd *self, struct cmd_ctx *ctx)
 {  {
         struct args                     *args = self->args;          struct args                     *args = self->args;
         struct window_choose_data       *cdata;  
         struct winlink                  *wl;          struct winlink                  *wl;
         struct session                  *s;          struct session                  *s;
           char                            *action;
         const char                      *template;          const char                      *template;
         u_int                            idx, cur;          u_int                            idx, cur;
   
Line 65 
Line 65 
         if ((template = args_get(args, 'F')) == NULL)          if ((template = args_get(args, 'F')) == NULL)
                 template = DEFAULT_SESSION_TEMPLATE;                  template = DEFAULT_SESSION_TEMPLATE;
   
           if (args->argc != 0)
                   action = xstrdup(args->argv[0]);
           else
                   action = xstrdup("switch-client -t '%%'");
   
         cur = idx = 0;          cur = idx = 0;
         RB_FOREACH(s, sessions, &sessions) {          RB_FOREACH(s, sessions, &sessions) {
                 if (s == ctx->curclient->session)                  if (s == ctx->curclient->session)
                         cur = idx;                          cur = idx;
                 idx++;                  idx++;
   
                 cdata = window_choose_data_create(ctx);                  window_choose_add_session(wl->window->active,
                 if (args->argc != 0)                      ctx, s, template, action, idx);
                         cdata->action = xstrdup(args->argv[0]);  
                 else  
                         cdata->action = xstrdup("switch-client -t '%%'");  
                 cdata->idx = s->idx;  
   
                 cdata->client->references++;  
                 cdata->session->references++;  
   
                 cdata->ft_template = xstrdup(template);  
                 format_add(cdata->ft, "line", "%u", idx);  
                 format_session(cdata->ft, s);  
   
                 window_choose_add(wl->window->active, cdata);  
         }          }
           xfree(action);
   
         window_choose_ready(wl->window->active,          window_choose_ready(wl->window->active,
             cur, cmd_choose_session_callback, cmd_choose_session_free);              cur, cmd_choose_session_callback, cmd_choose_session_free);
Line 97 
Line 90 
 void  void
 cmd_choose_session_callback(struct window_choose_data *cdata)  cmd_choose_session_callback(struct window_choose_data *cdata)
 {  {
         struct session  *s;  
   
         if (cdata == NULL)          if (cdata == NULL)
                 return;                  return;
         if (cdata->client->flags & CLIENT_DEAD)          if (cdata->client->flags & CLIENT_DEAD)
                 return;                  return;
   
         s = session_find_by_index(cdata->idx);  
         if (s == NULL)  
                 return;  
   
         cdata->raw_format = xstrdup(s->name);  
         window_choose_ctx(cdata);          window_choose_ctx(cdata);
 }  }
   
Line 121 
Line 107 
         cdata->client->references--;          cdata->client->references--;
         cdata->session->references--;          cdata->session->references--;
   
           xfree(cdata->command);
         xfree(cdata->ft_template);          xfree(cdata->ft_template);
         xfree(cdata->action);  
         format_free(cdata->ft);          format_free(cdata->ft);
         xfree(cdata);          xfree(cdata);
 }  }

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