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

Diff for /src/usr.bin/tmux/cmd-display-panes.c between version 1.42 and 1.43

version 1.42, 2021/08/21 10:22:39 version 1.43, 2021/08/23 12:33:55
Line 42 
Line 42 
 };  };
   
 struct cmd_display_panes_data {  struct cmd_display_panes_data {
         struct cmdq_item        *item;          struct cmdq_item                *item;
         char                    *command;          struct args_command_state       *state;
 };  };
   
 static void  static void
Line 207 
Line 207 
   
         if (cdata->item != NULL)          if (cdata->item != NULL)
                 cmdq_continue(cdata->item);                  cmdq_continue(cdata->item);
         free(cdata->command);          args_make_commands_free(cdata->state);
         free(cdata);          free(cdata);
 }  }
   
Line 215 
Line 215 
 cmd_display_panes_key(struct client *c, void *data, struct key_event *event)  cmd_display_panes_key(struct client *c, void *data, struct key_event *event)
 {  {
         struct cmd_display_panes_data   *cdata = data;          struct cmd_display_panes_data   *cdata = data;
         char                            *cmd, *expanded, *error;          char                            *expanded, *error;
           struct cmdq_item                *item = cdata->item, *new_item;
           struct cmd_list                 *cmdlist;
         struct window                   *w = c->session->curw->window;          struct window                   *w = c->session->curw->window;
         struct window_pane              *wp;          struct window_pane              *wp;
         enum cmd_parse_status            status;  
         u_int                            index;          u_int                            index;
         key_code                         key;          key_code                         key;
   
Line 239 
Line 240 
         window_unzoom(w);          window_unzoom(w);
   
         xasprintf(&expanded, "%%%u", wp->id);          xasprintf(&expanded, "%%%u", wp->id);
         cmd = cmd_template_replace(cdata->command, expanded, 1);  
   
         status = cmd_parse_and_append(cmd, NULL, c, NULL, &error);          cmdlist = args_make_commands(cdata->state, 1, &expanded, &error);
         if (status == CMD_PARSE_ERROR) {          if (cmdlist == NULL) {
                 cmdq_append(c, cmdq_get_error(error));                  cmdq_append(c, cmdq_get_error(error));
                 free(error);                  free(error);
           } else if (item == NULL) {
                   new_item = cmdq_get_command(cmdlist, NULL);
                   cmdq_append(c, new_item);
           } else {
                   new_item = cmdq_get_command(cmdlist, cmdq_get_state(item));
                   cmdq_insert_after(item, new_item);
         }          }
   
         free(cmd);  
         free(expanded);          free(expanded);
         return (1);          return (1);
 }  }
Line 261 
Line 266 
         u_int                            delay;          u_int                            delay;
         char                            *cause;          char                            *cause;
         struct cmd_display_panes_data   *cdata;          struct cmd_display_panes_data   *cdata;
           int                              wait = !args_has(args, 'b');
   
         if (tc->overlay_draw != NULL)          if (tc->overlay_draw != NULL)
                 return (CMD_RETURN_NORMAL);                  return (CMD_RETURN_NORMAL);
Line 275 
Line 281 
         } else          } else
                 delay = options_get_number(s->options, "display-panes-time");                  delay = options_get_number(s->options, "display-panes-time");
   
         cdata = xmalloc(sizeof *cdata);          cdata = xcalloc(1, sizeof *cdata);
         if (args_count(args))          if (wait)
                 cdata->command = xstrdup(args_string(args, 0));  
         else  
                 cdata->command = xstrdup("select-pane -t '%%'");  
         if (args_has(args, 'b'))  
                 cdata->item = NULL;  
         else  
                 cdata->item = item;                  cdata->item = item;
           cdata->state = args_make_commands_prepare(self, item, 0,
               "select-pane -t \"%%%\"", wait, 0);
   
         if (args_has(args, 'N')) {          if (args_has(args, 'N')) {
                 server_client_set_overlay(tc, delay, NULL, NULL,                  server_client_set_overlay(tc, delay, NULL, NULL,
Line 295 
Line 297 
                     cmd_display_panes_free, NULL, cdata);                      cmd_display_panes_free, NULL, cdata);
         }          }
   
         if (args_has(args, 'b'))          if (!wait)
                 return (CMD_RETURN_NORMAL);                  return (CMD_RETURN_NORMAL);
         return (CMD_RETURN_WAIT);          return (CMD_RETURN_WAIT);
 }  }

Legend:
Removed from v.1.42  
changed lines
  Added in v.1.43