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

Diff for /src/usr.bin/tmux/cmd-new-session.c between version 1.113 and 1.114

version 1.113, 2018/06/08 09:43:58 version 1.114, 2018/10/18 08:38:01
Line 71 
Line 71 
         struct session          *s, *as, *groupwith;          struct session          *s, *as, *groupwith;
         struct window           *w;          struct window           *w;
         struct environ          *env;          struct environ          *env;
           struct options          *oo;
         struct termios           tio, *tiop;          struct termios           tio, *tiop;
         struct session_group    *sg;          struct session_group    *sg;
         const char              *errstr, *template, *group, *prefix;          const char              *errstr, *template, *group, *prefix;
         const char              *path, *cmd, *tmp;          const char              *path, *cmd, *tmp, *value;
         char                   **argv, *cause, *cp, *newname, *cwd = NULL;          char                   **argv, *cause, *cp, *newname, *cwd = NULL;
         int                      detached, already_attached, idx, argc;          int                      detached, already_attached, idx, argc;
         int                      is_control = 0;          int                      is_control = 0;
         u_int                    sx, sy;          u_int                    sx, sy, dsx = 80, dsy = 24;
         struct environ_entry    *envent;          struct environ_entry    *envent;
         struct cmd_find_state    fs;          struct cmd_find_state    fs;
         enum cmd_retval          retval;          enum cmd_retval          retval;
Line 189 
Line 190 
                 }                  }
         }          }
   
         /* Find new session size. */          /* Get default session size. */
         if (!detached) {          if (args_has(args, 'x')) {
                 sx = c->tty.sx;  
                 sy = c->tty.sy;  
                 if (!is_control &&  
                     sy > 0 &&  
                     options_get_number(global_s_options, "status"))  
                         sy--;  
         } else {  
                 sx = 80;  
                 sy = 24;  
         }  
         if ((is_control || detached) && args_has(args, 'x')) {  
                 tmp = args_get(args, 'x');                  tmp = args_get(args, 'x');
                 if (strcmp(tmp, "-") == 0) {                  if (strcmp(tmp, "-") == 0) {
                         if (c != NULL)                          if (c != NULL)
                                 sx = c->tty.sx;                                  dsx = c->tty.sx;
                 } else {                  } else {
                         sx = strtonum(tmp, 1, USHRT_MAX, &errstr);                          dsx = strtonum(tmp, 1, USHRT_MAX, &errstr);
                         if (errstr != NULL) {                          if (errstr != NULL) {
                                 cmdq_error(item, "width %s", errstr);                                  cmdq_error(item, "width %s", errstr);
                                 goto error;                                  goto error;
                         }                          }
                 }                  }
         }          }
         if ((is_control || detached) && args_has(args, 'y')) {          if (args_has(args, 'y')) {
                 tmp = args_get(args, 'y');                  tmp = args_get(args, 'y');
                 if (strcmp(tmp, "-") == 0) {                  if (strcmp(tmp, "-") == 0) {
                         if (c != NULL)                          if (c != NULL)
                                 sy = c->tty.sy;                                  dsy = c->tty.sy;
                 } else {                  } else {
                         sy = strtonum(tmp, 1, USHRT_MAX, &errstr);                          dsy = strtonum(tmp, 1, USHRT_MAX, &errstr);
                         if (errstr != NULL) {                          if (errstr != NULL) {
                                 cmdq_error(item, "height %s", errstr);                                  cmdq_error(item, "height %s", errstr);
                                 goto error;                                  goto error;
                         }                          }
                 }                  }
         }          }
   
           /* Find new session size. */
           if (!detached && !is_control) {
                   sx = c->tty.sx;
                   sy = c->tty.sy;
                   if (!is_control &&
                       sy > 0 &&
                       options_get_number(global_s_options, "status"))
                           sy--;
           } else {
                   value = options_get_string(global_s_options, "default-size");
                   if (sscanf(value, "%ux%u", &sx, &sy) != 2) {
                           sx = 80;
                           sy = 24;
                   }
                   if (args_has(args, 'x'))
                           sx = dsx;
                   if (args_has(args, 'y'))
                           sy = dsy;
           }
         if (sx == 0)          if (sx == 0)
                 sx = 1;                  sx = 1;
         if (sy == 0)          if (sy == 0)
Line 262 
Line 272 
         if (c != NULL && !args_has(args, 'E'))          if (c != NULL && !args_has(args, 'E'))
                 environ_update(global_s_options, c->environ, env);                  environ_update(global_s_options, c->environ, env);
   
           /* Set up the options. */
           oo = options_create(global_s_options);
           if (args_has(args, 'x') || args_has(args, 'y'))
                   options_set_string(oo, "default-size", 0, "%ux%u", dsx, dsy);
   
         /* Create the new session. */          /* Create the new session. */
         idx = -1 - options_get_number(global_s_options, "base-index");          idx = -1 - options_get_number(global_s_options, "base-index");
         s = session_create(prefix, newname, argc, argv, path, cwd, env, tiop,          s = session_create(prefix, newname, argc, argv, path, cwd, env, oo,
             idx, sx, sy, &cause);              tiop, idx, &cause);
         environ_free(env);          environ_free(env);
         if (s == NULL) {          if (s == NULL) {
                 cmdq_error(item, "create session failed: %s", cause);                  cmdq_error(item, "create session failed: %s", cause);
Line 313 
Line 328 
                 c->session = s;                  c->session = s;
                 if (~item->shared->flags & CMDQ_SHARED_REPEAT)                  if (~item->shared->flags & CMDQ_SHARED_REPEAT)
                         server_client_set_key_table(c, NULL);                          server_client_set_key_table(c, NULL);
                   tty_update_client_offset(c);
                 status_timer_start(c);                  status_timer_start(c);
                 notify_client("client-session-changed", c);                  notify_client("client-session-changed", c);
                 session_update_activity(s, NULL);                  session_update_activity(s, NULL);

Legend:
Removed from v.1.113  
changed lines
  Added in v.1.114