Here's a test:

diff --git i/src/testdir/test_winbuf_close.vim 
w/src/testdir/test_winbuf_close.vim
index 7f5b80e8d..f32735e45 100644
--- i/src/testdir/test_winbuf_close.vim
+++ w/src/testdir/test_winbuf_close.vim
@@ -194,3 +194,23 @@ func Test_tabwin_close()
   call assert_true(v:true)
   %bwipe!
 endfunc
+
+
+" Test if closing a split window (above/below) restores space to the window
+" below when noequalalways and splitright are set
+"
+func Test_window_close_splitright_noequalalways()
+    set noequalalways
+    set splitright
+    new
+    let l:w1 = win_getid()
+    new
+    let l:w2 = win_getid()
+    execute "normal \<c-w>b"
+    let l:h = winheight(0)
+    let l:w = win_getid()
+    new 
+    q
+    call assert_equal(l:h,winheight(0),"Window height does not match 
height before opening and closing another window")
+    call assert_equal(l:w,win_getid(),"Did not return to original window 
after opening and closing a window")
+endfunc




On Tuesday, April 14, 2020 at 3:29:50 PM UTC-7, Mark Waggoner wrote:
>
> This seems to work better:
>
> diff --git i/src/window.c w/src/window.c
> index 7efe7b164..e28955d1b 100644
> --- i/src/window.c
> +++ w/src/window.c
> @@ -2967,10 +2967,18 @@ win_altframe(
>      if (frp->fr_next == NULL)
>         return frp->fr_prev;
>  
> +    // By default the next window will get the space that was abandoned 
> by this window
>      target_fr = frp->fr_next;
>      other_fr  = frp->fr_prev;
> -    if (p_spr || p_sb)
> -    {
> +
> +    // If this is part of a column of windows, and splitbelow is true 
> then the previous will get the space
> +    if (frp->fr_parent != NULL && frp->fr_parent->fr_layout == FR_COL && 
> p_sb) {
> +       target_fr = frp->fr_prev;
> +       other_fr  = frp->fr_next;
> +    }
> +
> +    // If this is part of a row of windows, and splitright is true then 
> the previous will get the space
> +    if (frp->fr_parent != NULL && frp->fr_parent->fr_layout == FR_ROW && 
> p_spr) {
>         target_fr = frp->fr_prev;
>         other_fr  = frp->fr_next;
>      }
>
>
>
> On Tuesday, April 14, 2020 at 10:23:01 AM UTC-7, Mark Waggoner wrote:
>>
>> If you have splitright and noequalalways set, when you split a window 
>> (normal horizontal split, not vertical split), the split will appear above 
>> the current window.
>> When you close the split window, the space is restored to the window 
>> ABOVE, not back to the window below.
>>
>> I can see that this is intentionally done in window.c:
>> /*
>>  * 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(
>>
>> Is there some way to have this be a little more intelligent about where 
>> the window space is restored?
>>
>> Mark Waggoner
>>
>>
>>
>>

-- 
-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/2a7167c0-86fb-4264-b24c-7bcca7667bc5%40googlegroups.com.

Raspunde prin e-mail lui