diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-06-25 22:45:39 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-06-25 22:45:39 +0200 |
commit | 8eeeba8c025ff844e6514c4a60cec11bf1fc1b35 (patch) | |
tree | 1407bb110c8aa4cee4db9d668e27508f57616f72 | |
parent | 1814183b865059679f6ee526ec23fc575e536e66 (diff) | |
download | vim-git-8eeeba8c025ff844e6514c4a60cec11bf1fc1b35.tar.gz |
patch 8.0.0678: closing a window does not trigger resizingv8.0.0678
Problem: When 'equalalways' is set and closing a window in a separate
frame, not all window sizes are adjusted. (Glacambre)
Solution: Resize all windows if the new current window is not in the same
frame as the closed window. (closes #1707)
-rw-r--r-- | src/testdir/test_window_cmd.vim | 44 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/window.c | 6 |
3 files changed, 51 insertions, 1 deletions
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim index f7d5317f2..2402ecfe0 100644 --- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -318,6 +318,50 @@ func Test_window_width() bw Xa Xb Xc endfunc +func Test_equalalways_on_close() + set equalalways + vsplit + windo split + split + wincmd J + " now we have a frame top-left with two windows, a frame top-right with two + " windows and a frame at the bottom, full-width. + let height_1 = winheight(1) + let height_2 = winheight(2) + let height_3 = winheight(3) + let height_4 = winheight(4) + " closing the bottom window causes all windows to be resized. + close + call assert_notequal(height_1, winheight(1)) + call assert_notequal(height_2, winheight(2)) + call assert_notequal(height_3, winheight(3)) + call assert_notequal(height_4, winheight(4)) + call assert_equal(winheight(1), winheight(3)) + call assert_equal(winheight(2), winheight(4)) + + 1wincmd w + split + 4wincmd w + resize + 5 + " left column has three windows, equalized heights. + " right column has two windows, top one a bit higher + let height_1 = winheight(1) + let height_2 = winheight(2) + let height_4 = winheight(4) + let height_5 = winheight(5) + 3wincmd w + " closing window in left column equalizes heights in left column but not in + " the right column + close + call assert_notequal(height_1, winheight(1)) + call assert_notequal(height_2, winheight(2)) + call assert_equal(height_4, winheight(3)) + call assert_equal(height_5, winheight(4)) + + only + set equalalways& +endfunc + func Test_window_jump_tag() help /iccf diff --git a/src/version.c b/src/version.c index 3dd0527aa..192165fc6 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 678, +/**/ 677, /**/ 676, diff --git a/src/window.c b/src/window.c index 2ef319805..8078e011d 100644 --- a/src/window.c +++ b/src/window.c @@ -2282,6 +2282,7 @@ win_close(win_T *win, int free_buf) int dir; int help_window = FALSE; tabpage_T *prev_curtab = curtab; + frame_T *win_frame = win->w_frame; if (last_window()) { @@ -2459,7 +2460,10 @@ win_close(win_T *win, int free_buf) check_cursor(); } if (p_ea && (*p_ead == 'b' || *p_ead == dir)) - win_equal(curwin, TRUE, dir); + /* If the frame of the closed window contains the new current window, + * only resize that frame. Otherwise resize all windows. */ + win_equal(curwin, + curwin->w_frame->fr_parent == win_frame->fr_parent, dir); else win_comp_pos(); if (close_curwin) |