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

Diff for /src/usr.bin/tmux/cmd-join-pane.c between version 1.35 and 1.36

version 1.35, 2019/06/20 11:59:59 version 1.36, 2019/10/15 08:25:37
Line 21 
Line 21 
   
 #include <paths.h>  #include <paths.h>
 #include <stdlib.h>  #include <stdlib.h>
   #include <string.h>
 #include <unistd.h>  #include <unistd.h>
   
 #include "tmux.h"  #include "tmux.h"
Line 36 
Line 37 
         .alias = "joinp",          .alias = "joinp",
   
         .args = { "bdhvp:l:s:t:", 0, 0 },          .args = { "bdhvp:l:s:t:", 0, 0 },
         .usage = "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE,          .usage = "[-bdhv] [-l size] " CMD_SRCDST_PANE_USAGE,
   
         .source = { 's', CMD_FIND_PANE, CMD_FIND_DEFAULT_MARKED },          .source = { 's', CMD_FIND_PANE, CMD_FIND_DEFAULT_MARKED },
         .target = { 't', CMD_FIND_PANE, 0 },          .target = { 't', CMD_FIND_PANE, 0 },
Line 68 
Line 69 
         struct winlink          *src_wl, *dst_wl;          struct winlink          *src_wl, *dst_wl;
         struct window           *src_w, *dst_w;          struct window           *src_w, *dst_w;
         struct window_pane      *src_wp, *dst_wp;          struct window_pane      *src_wp, *dst_wp;
         char                    *cause;          char                    *cause, *copy;
         int                      size, percentage, dst_idx;          const char              *errstr, *p;
           size_t                   plen;
           int                      size, percentage, dst_idx, not_same_window;
           int                      flags;
         enum layout_type         type;          enum layout_type         type;
         struct layout_cell      *lc;          struct layout_cell      *lc;
         int                      not_same_window, flags;  
   
         if (self->entry == &cmd_join_pane_entry)          if (self->entry == &cmd_join_pane_entry)
                 not_same_window = 1;                  not_same_window = 1;
Line 105 
Line 108 
                 type = LAYOUT_LEFTRIGHT;                  type = LAYOUT_LEFTRIGHT;
   
         size = -1;          size = -1;
         if (args_has(args, 'l')) {          if ((p = args_get(args, 'l')) != NULL) {
                 size = args_strtonum(args, 'l', 0, INT_MAX, &cause);                  plen = strlen(p);
                 if (cause != NULL) {                  if (p[plen - 1] == '%') {
                         cmdq_error(item, "size %s", cause);                          copy = xstrdup(p);
                         free(cause);                          copy[plen - 1] = '\0';
                         return (CMD_RETURN_ERROR);                          percentage = strtonum(copy, 0, INT_MAX, &errstr);
                           free(copy);
                           if (errstr != NULL) {
                                   cmdq_error(item, "percentage %s", errstr);
                                   return (CMD_RETURN_ERROR);
                           }
                           if (type == LAYOUT_TOPBOTTOM)
                                   size = (dst_wp->sy * percentage) / 100;
                           else
                                   size = (dst_wp->sx * percentage) / 100;
                   } else {
                           size = args_strtonum(args, 'l', 0, INT_MAX, &cause);
                           if (cause != NULL) {
                                   cmdq_error(item, "size %s", cause);
                                   free(cause);
                                   return (CMD_RETURN_ERROR);
                           }
                 }                  }
         } else if (args_has(args, 'p')) {          } else if (args_has(args, 'p')) {
                 percentage = args_strtonum(args, 'p', 0, 100, &cause);                  percentage = args_strtonum(args, 'p', 0, 100, &cause);

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36