Patch 8.0.1790
Problem:    'winfixwidth' is not always respected by :close.
Solution:   Prefer a frame without 'winfixwidth' or 'winfixheight'. (Jason
            Franklin)
Files:      src/window.c, src/testdir/test_winbuf_close.vim


*** ../vim-8.0.1789/src/window.c        2018-04-13 22:15:42.431294621 +0200
--- src/window.c        2018-05-04 20:09:46.881003696 +0200
***************
*** 2740,2751 ****
  }
  
  /*
!  * Find out which frame is going to get the freed up space when "win" is
!  * closed.
!  * if 'splitbelow'/'splitleft' the space goes to the window above/left.
!  * if 'nosplitbelow'/'nosplitleft' the space goes to the window below/right.
!  * This makes opening a window and closing it immediately keep the same window
!  * layout.
   */
      static frame_T *
  win_altframe(
--- 2740,2753 ----
  }
  
  /*
!  * Return a pointer to the frame that will receive the empty screen space that
!  * is left over after "win" is closed.
!  *
!  * If 'splitbelow' or 'splitright' is set, the space goes above or to the left
!  * by default.  Otherwise, the free space goes below or to the right.  The
!  * result is that opening a window and then immediately closing it will
!  * preserve the initial window layout.  The 'wfh' and 'wfw' settings are
!  * respected when possible.
   */
      static frame_T *
  win_altframe(
***************
*** 2753,2772 ****
      tabpage_T *tp)            /* tab page "win" is in, NULL for current */
  {
      frame_T   *frp;
!     int               b;
  
      if (tp == NULL ? ONE_WINDOW : tp->tp_firstwin == tp->tp_lastwin)
-       /* Last window in this tab page, will go to next tab page. */
        return alt_tabpage()->tp_curwin->w_frame;
  
      frp = win->w_frame;
      if (frp->fr_parent != NULL && frp->fr_parent->fr_layout == FR_ROW)
!       b = p_spr;
      else
!       b = p_sb;
!     if ((!b && frp->fr_next != NULL) || frp->fr_prev == NULL)
!       return frp->fr_next;
!     return frp->fr_prev;
  }
  
  /*
--- 2755,2794 ----
      tabpage_T *tp)            /* tab page "win" is in, NULL for current */
  {
      frame_T   *frp;
!     frame_T   *other_fr, *target_fr;
  
      if (tp == NULL ? ONE_WINDOW : tp->tp_firstwin == tp->tp_lastwin)
        return alt_tabpage()->tp_curwin->w_frame;
  
      frp = win->w_frame;
+ 
+     if (frp->fr_prev == NULL)
+       return frp->fr_next;
+     if (frp->fr_next == NULL)
+       return frp->fr_prev;
+ 
+     target_fr = frp->fr_next;
+     other_fr  = frp->fr_prev;
+     if (p_spr || p_sb)
+     {
+       target_fr = frp->fr_prev;
+       other_fr  = frp->fr_next;
+     }
+ 
+     /* If 'wfh' or 'wfw' is set for the target and not for the alternate
+      * window, reverse the selection. */
      if (frp->fr_parent != NULL && frp->fr_parent->fr_layout == FR_ROW)
!     {
!       if (frame_fixed_width(target_fr) && !frame_fixed_width(other_fr))
!           target_fr = other_fr;
!     }
      else
!     {
!       if (frame_fixed_height(target_fr) && !frame_fixed_height(other_fr))
!           target_fr = other_fr;
!     }
! 
!     return target_fr;
  }
  
  /*
*** ../vim-8.0.1789/src/testdir/test_winbuf_close.vim   2017-10-12 
21:28:53.969436351 +0200
--- src/testdir/test_winbuf_close.vim   2018-05-04 20:13:46.699397642 +0200
***************
*** 122,124 ****
--- 122,160 ----
    call delete('Xtest2')
    call delete('Xtest3')
  endfunc
+ 
+ " Test that ":close" will respect 'winfixheight' when possible.
+ func Test_winfixheight_on_close()
+   set nosplitbelow nosplitright
+ 
+   split | split | vsplit
+ 
+   $wincmd w
+   setlocal winfixheight
+   let l:height = winheight(0)
+ 
+   3close
+ 
+   call assert_equal(l:height, winheight(0))
+ 
+   %bwipeout!
+   setlocal nowinfixheight splitbelow& splitright&
+ endfunc
+ 
+ " Test that ":close" will respect 'winfixwidth' when possible.
+ func Test_winfixwidth_on_close()
+   set nosplitbelow nosplitright
+ 
+   vsplit | vsplit | split
+ 
+   $wincmd w
+   setlocal winfixwidth
+   let l:width = winwidth(0)
+ 
+   3close
+ 
+   call assert_equal(l:width, winwidth(0))
+ 
+   %bwipeout!
+   setlocal nowinfixwidth splitbelow& splitright&
+ endfunction
*** ../vim-8.0.1789/src/version.c       2018-05-03 20:40:15.714154543 +0200
--- src/version.c       2018-05-04 20:14:59.090912997 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     1790,
  /**/

-- 
A computer programmer is a device for turning requirements into
undocumented features.  It runs on cola, pizza and Dilbert cartoons.
                                        Bram Moolenaar

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui