[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.7 and 1.8

version 1.7, 2011/01/23 15:49:10 version 1.8, 2012/03/03 08:31:18
Line 1 
Line 1 
 /* $OpenBSD$ */  /* $OpenBSD$ */
   
 /*  /*
    * Copyright (c) 2011 George Nachman <tmux@georgester.com>
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>   * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
Line 25 
Line 26 
 #include "tmux.h"  #include "tmux.h"
   
 /*  /*
  * Join a pane into another (like split/swap/kill).   * Join or move a pane into another (like split/swap/kill).
  */   */
   
 void    cmd_join_pane_key_binding(struct cmd *, int);  void    cmd_join_pane_key_binding(struct cmd *, int);
 int     cmd_join_pane_exec(struct cmd *, struct cmd_ctx *);  int     cmd_join_pane_exec(struct cmd *, struct cmd_ctx *);
   
   int     join_pane(struct cmd *, struct cmd_ctx *, int);
   
 const struct cmd_entry cmd_join_pane_entry = {  const struct cmd_entry cmd_join_pane_entry = {
         "join-pane", "joinp",          "join-pane", "joinp",
         "dhvp:l:s:t:", 0, 0,          "bdhvp:l:s:t:", 0, 0,
         "[-dhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]",          "[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]",
         0,          0,
         cmd_join_pane_key_binding,          cmd_join_pane_key_binding,
         NULL,          NULL,
         cmd_join_pane_exec          cmd_join_pane_exec
 };  };
   
   const struct cmd_entry cmd_move_pane_entry = {
           "move-pane", "movep",
           "bdhvp:l:s:t:", 0, 0,
           "[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]",
           0,
           NULL,
           NULL,
           cmd_join_pane_exec
   };
   
 void  void
 cmd_join_pane_key_binding(struct cmd *self, int key)  cmd_join_pane_key_binding(struct cmd *self, int key)
 {  {
Line 58 
Line 71 
 int  int
 cmd_join_pane_exec(struct cmd *self, struct cmd_ctx *ctx)  cmd_join_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
 {  {
           return join_pane(self, ctx, self->entry == &cmd_join_pane_entry);
   }
   
   int
   join_pane(struct cmd *self, struct cmd_ctx *ctx, int not_same_window)
   {
         struct args             *args = self->args;          struct args             *args = self->args;
         struct session          *dst_s;          struct session          *dst_s;
         struct winlink          *src_wl, *dst_wl;          struct winlink          *src_wl, *dst_wl;
Line 79 
Line 98 
                 return (-1);                  return (-1);
         src_w = src_wl->window;          src_w = src_wl->window;
   
         if (src_w == dst_w) {          if (not_same_window && src_w == dst_w) {
                 ctx->error(ctx, "can't join a pane to its own window");                  ctx->error(ctx, "can't join a pane to its own window");
                 return (-1);                  return (-1);
         }          }
           if (!not_same_window && src_wp == dst_wp) {
                   ctx->error(ctx, "source and target panes must be different");
                   return (-1);
           }
   
         type = LAYOUT_TOPBOTTOM;          type = LAYOUT_TOPBOTTOM;
         if (args_has(args, 'h'))          if (args_has(args, 'h'))
Line 108 
Line 131 
                 else                  else
                         size = (dst_wp->sx * percentage) / 100;                          size = (dst_wp->sx * percentage) / 100;
         }          }
           lc = layout_split_pane(dst_wp, type, size, args_has(args, 'b'));
         if ((lc = layout_split_pane(dst_wp, type, size)) == NULL) {          if (lc == NULL) {
                 ctx->error(ctx, "create pane failed: pane too small");                  ctx->error(ctx, "create pane failed: pane too small");
                 return (-1);                  return (-1);
         }          }

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