[BACK]Return to layout.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/layout.c between version 1.8 and 1.9

version 1.8, 2012/01/29 09:37:02 version 1.9, 2012/03/03 08:31:18
Line 616 
Line 616 
  * split. This must be followed by layout_assign_pane before much else happens!   * split. This must be followed by layout_assign_pane before much else happens!
  **/   **/
 struct layout_cell *  struct layout_cell *
 layout_split_pane(struct window_pane *wp, enum layout_type type, int size)  layout_split_pane(
       struct window_pane *wp, enum layout_type type, int size, int insert_before)
 {  {
         struct layout_cell     *lc, *lcparent, *lcnew;          struct layout_cell     *lc, *lcparent, *lcnew, *lc1, *lc2;
         u_int                   sx, sy, xoff, yoff, size1, size2;          u_int                   sx, sy, xoff, yoff, size1, size2;
   
         lc = wp->layout_cell;          lc = wp->layout_cell;
Line 650 
Line 651 
                  */                   */
   
                 /* Create the new child cell. */                  /* Create the new child cell. */
                 lcnew = layout_create_cell(lc->parent);                  lcparent = lc->parent;
                 TAILQ_INSERT_AFTER(&lc->parent->cells, lc, lcnew, entry);                  lcnew = layout_create_cell(lcparent);
                   if (insert_before)
                           TAILQ_INSERT_BEFORE(lc, lcnew, entry);
                   else
                           TAILQ_INSERT_AFTER(&lcparent->cells, lc, lcnew, entry);
         } else {          } else {
                 /*                  /*
                  * Otherwise create a new parent and insert it.                   * Otherwise create a new parent and insert it.
Line 672 
Line 677 
   
                 /* Create the new child cell. */                  /* Create the new child cell. */
                 lcnew = layout_create_cell(lcparent);                  lcnew = layout_create_cell(lcparent);
                 TAILQ_INSERT_TAIL(&lcparent->cells, lcnew, entry);                  if (insert_before)
                           TAILQ_INSERT_HEAD(&lcparent->cells, lcnew, entry);
                   else
                           TAILQ_INSERT_TAIL(&lcparent->cells, lcnew, entry);
         }          }
           if (insert_before) {
                   lc1 = lcnew;
                   lc2 = lc;
           } else {
                   lc1 = lc;
                   lc2 = lcnew;
           }
   
         /* Set new cell sizes.  size is the target size or -1 for middle split,          /* Set new cell sizes.  size is the target size or -1 for middle split,
          * size1 is the size of the top/left and size2 the bottom/right.           * size1 is the size of the top/left and size2 the bottom/right.
Line 689 
Line 704 
                 else if (size2 > sx - 2)                  else if (size2 > sx - 2)
                         size2 = sx - 2;                          size2 = sx - 2;
                 size1 = sx - 1 - size2;                  size1 = sx - 1 - size2;
                 layout_set_size(lc, size1, sy, xoff, yoff);                  layout_set_size(lc1, size1, sy, xoff, yoff);
                 layout_set_size(lcnew, size2, sy, xoff + lc->sx + 1, yoff);                  layout_set_size(lc2, size2, sy, xoff + lc1->sx + 1, yoff);
                 break;                  break;
         case LAYOUT_TOPBOTTOM:          case LAYOUT_TOPBOTTOM:
                 if (size < 0)                  if (size < 0)
Line 702 
Line 717 
                 else if (size2 > sy - 2)                  else if (size2 > sy - 2)
                         size2 = sy - 2;                          size2 = sy - 2;
                 size1 = sy - 1 - size2;                  size1 = sy - 1 - size2;
                 layout_set_size(lc, sx, size1, xoff, yoff);                  layout_set_size(lc1, sx, size1, xoff, yoff);
                 layout_set_size(lcnew, sx, size2, xoff, yoff + lc->sy + 1);                  layout_set_size(lc2, sx, size2, xoff, yoff + lc1->sy + 1);
                 break;                  break;
         default:          default:
                 fatalx("bad layout type");                  fatalx("bad layout type");

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