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

Diff for /src/usr.bin/tmux/cmd-new-window.c between version 1.30 and 1.31

version 1.30, 2013/03/24 09:27:20 version 1.31, 2013/03/24 09:54:10
Line 26 
Line 26 
  * Create a new window.   * Create a new window.
  */   */
   
 enum cmd_retval cmd_new_window_exec(struct cmd *, struct cmd_ctx *);  enum cmd_retval cmd_new_window_exec(struct cmd *, struct cmd_q *);
   
 const struct cmd_entry cmd_new_window_entry = {  const struct cmd_entry cmd_new_window_entry = {
         "new-window", "neww",          "new-window", "neww",
Line 40 
Line 40 
 };  };
   
 enum cmd_retval  enum cmd_retval
 cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)  cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
 {  {
         struct args             *args = self->args;          struct args             *args = self->args;
         struct session          *s;          struct session          *s;
Line 54 
Line 54 
         char                    *cp;          char                    *cp;
   
         if (args_has(args, 'a')) {          if (args_has(args, 'a')) {
                 wl = cmd_find_window(ctx, args_get(args, 't'), &s);                  wl = cmd_find_window(cmdq, args_get(args, 't'), &s);
                 if (wl == NULL)                  if (wl == NULL)
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 idx = wl->idx + 1;                  idx = wl->idx + 1;
Line 65 
Line 65 
                                 break;                                  break;
                 }                  }
                 if (last == INT_MAX) {                  if (last == INT_MAX) {
                         ctx->error(ctx, "no free window indexes");                          cmdq_error(cmdq, "no free window indexes");
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 }                  }
   
Line 76 
Line 76 
                         server_unlink_window(s, wl);                          server_unlink_window(s, wl);
                 }                  }
         } else {          } else {
                 if ((idx = cmd_find_index(ctx, args_get(args, 't'), &s)) == -2)                  if ((idx = cmd_find_index(cmdq, args_get(args, 't'), &s)) == -2)
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
         }          }
         detached = args_has(args, 'd');          detached = args_has(args, 'd');
Line 105 
Line 105 
                 cmd = options_get_string(&s->options, "default-command");                  cmd = options_get_string(&s->options, "default-command");
         else          else
                 cmd = args->argv[0];                  cmd = args->argv[0];
         cwd = cmd_get_default_path(ctx, args_get(args, 'c'));          cwd = cmd_get_default_path(cmdq, args_get(args, 'c'));
   
         if (idx == -1)          if (idx == -1)
                 idx = -1 - options_get_number(&s->options, "base-index");                  idx = -1 - options_get_number(&s->options, "base-index");
         wl = session_new(s, args_get(args, 'n'), cmd, cwd, idx, &cause);          wl = session_new(s, args_get(args, 'n'), cmd, cwd, idx, &cause);
         if (wl == NULL) {          if (wl == NULL) {
                 ctx->error(ctx, "create window failed: %s", cause);                  cmdq_error(cmdq, "create window failed: %s", cause);
                 free(cause);                  free(cause);
                 return (CMD_RETURN_ERROR);                  return (CMD_RETURN_ERROR);
         }          }
Line 126 
Line 126 
                         template = NEW_WINDOW_TEMPLATE;                          template = NEW_WINDOW_TEMPLATE;
   
                 ft = format_create();                  ft = format_create();
                 if ((c = cmd_find_client(ctx, NULL, 1)) != NULL)                  if ((c = cmd_find_client(cmdq, NULL, 1)) != NULL)
                     format_client(ft, c);                          format_client(ft, c);
                 format_session(ft, s);                  format_session(ft, s);
                 format_winlink(ft, s, wl);                  format_winlink(ft, s, wl);
                 format_window_pane(ft, wl->window->active);                  format_window_pane(ft, wl->window->active);
   
                 cp = format_expand(ft, template);                  cp = format_expand(ft, template);
                 ctx->print(ctx, "%s", cp);                  cmdq_print(cmdq, "%s", cp);
                 free(cp);                  free(cp);
   
                 format_free(ft);                  format_free(ft);

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31