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

Diff for /src/usr.bin/tmux/Attic/cmd-choose-buffer.c between version 1.6 and 1.7

version 1.6, 2012/06/25 14:08:55 version 1.7, 2012/06/25 14:27:25
Line 48 
Line 48 
         struct window_choose_data       *cdata;          struct window_choose_data       *cdata;
         struct winlink                  *wl;          struct winlink                  *wl;
         struct paste_buffer             *pb;          struct paste_buffer             *pb;
         u_int                            idx;          char                            *action, *action_data;
         const char                      *template;          const char                      *template;
           u_int                            idx;
   
         if (ctx->curclient == NULL) {          if (ctx->curclient == NULL) {
                 ctx->error(ctx, "must be run interactively");                  ctx->error(ctx, "must be run interactively");
Line 68 
Line 69 
         if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)          if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)
                 return (0);                  return (0);
   
           if (args->argc != 0)
                   action = xstrdup(args->argv[0]);
           else
                   action = xstrdup("paste-buffer -b '%%'");
   
         idx = 0;          idx = 0;
         while ((pb = paste_walk_stack(&global_buffers, &idx)) != NULL) {          while ((pb = paste_walk_stack(&global_buffers, &idx)) != NULL) {
                 cdata = window_choose_data_create(ctx);                  cdata = window_choose_data_create(ctx);
                 if (args->argc != 0)  
                         cdata->action = xstrdup(args->argv[0]);  
                 else  
                         cdata->action = xstrdup("paste-buffer -b '%%'");  
   
                 cdata->idx = idx - 1;                  cdata->idx = idx - 1;
                 cdata->client->references++;                  cdata->client->references++;
   
Line 83 
Line 84 
                 format_add(cdata->ft, "line", "%u", idx - 1);                  format_add(cdata->ft, "line", "%u", idx - 1);
                 format_paste_buffer(cdata->ft, pb);                  format_paste_buffer(cdata->ft, pb);
   
                   xasprintf(&action_data, "%u", idx - 1);
                   cdata->command = cmd_template_replace(action, action_data, 1);
                   xfree(action_data);
   
                 window_choose_add(wl->window->active, cdata);                  window_choose_add(wl->window->active, cdata);
         }          }
           xfree(action);
   
         window_choose_ready(wl->window->active,          window_choose_ready(wl->window->active,
             0, cmd_choose_buffer_callback, cmd_choose_buffer_free);              0, cmd_choose_buffer_callback, cmd_choose_buffer_free);
Line 100 
Line 106 
         if (cdata->client->flags & CLIENT_DEAD)          if (cdata->client->flags & CLIENT_DEAD)
                 return;                  return;
   
         xasprintf(&cdata->raw_format, "%u", cdata->idx);  
         window_choose_ctx(cdata);          window_choose_ctx(cdata);
 }  }
   
Line 114 
Line 119 
   
         cdata->client->references--;          cdata->client->references--;
   
           xfree(cdata->command);
         xfree(cdata->ft_template);          xfree(cdata->ft_template);
         xfree(cdata->action);  
         xfree(cdata->raw_format);  
         xfree(cdata);          xfree(cdata);
 }  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7