diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-04-15 20:05:47 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-04-15 20:05:47 +0200 |
commit | edd327cc070d9a05c12e88bc5c43a1e2a3086ae6 (patch) | |
tree | 87803704bbf8113eabca5d5c6e4fd231daf55a82 | |
parent | 4d5d0dfe9438bd5f2daa41ebbe6ac9a76d165af0 (diff) | |
download | vim-git-edd327cc070d9a05c12e88bc5c43a1e2a3086ae6.tar.gz |
patch 8.2.0580: window size wrong if 'ea' is off and 'splitright' is onv8.2.0580
Problem: Window size wrong if 'ea' is off and 'splitright' is on and
splitting then closing a window.
Solution: Put abandoned window space in the right place. (Mark Waggoner)
-rw-r--r-- | src/testdir/test_winbuf_close.vim | 19 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/window.c | 15 |
3 files changed, 35 insertions, 1 deletions
diff --git a/src/testdir/test_winbuf_close.vim b/src/testdir/test_winbuf_close.vim index 7f5b80e8d..f4878c239 100644 --- a/src/testdir/test_winbuf_close.vim +++ b/src/testdir/test_winbuf_close.vim @@ -194,3 +194,22 @@ func Test_tabwin_close() call assert_true(v:true) %bwipe! endfunc + +" Test when 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 w1 = win_getid() + new + let w2 = win_getid() + execute "normal \<c-w>b" + let h = winheight(0) + let w = win_getid() + new + q + call assert_equal(h, winheight(0), "Window height does not match eight before opening and closing another window") + call assert_equal(w, win_getid(), "Did not return to original window after opening and closing a window") +endfunc + diff --git a/src/version.c b/src/version.c index 58827f2f4..0f0ee6d0a 100644 --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 580, +/**/ 579, /**/ 578, diff --git a/src/window.c b/src/window.c index 7efe7b164..7c18c06a7 100644 --- a/src/window.c +++ b/src/window.c @@ -2967,9 +2967,22 @@ 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 window 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 window 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; |