diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-08-31 17:49:14 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-31 17:49:14 +0100 |
commit | 21c3a80a7fd6b7fc250ce5dc287963511f54b86f (patch) | |
tree | cd168faa29c9027bc3f7edfd2b6f2e87defa90b8 /src/testdir | |
parent | 92a3d20682d46359bb50a452b4f831659e799155 (diff) |
patch 9.0.0342: ":wincmd =" equalizes in two directionsv9.0.0342
Problem: ":wincmd =" equalizes in two directions.
Solution: Make ":vertical wincmd =" equalize vertically only and
":horizontal wincmd =" equalize horizontally only.
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_window_cmd.vim | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim index 04a5d1058d..bea612f236 100644 --- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -367,6 +367,46 @@ func Test_window_height() bw Xa Xb Xc endfunc +func Test_wincmd_equal() + edit Xone + below split Xtwo + rightbelow vsplit Xthree + call assert_equal('Xone', bufname(winbufnr(1))) + call assert_equal('Xtwo', bufname(winbufnr(2))) + call assert_equal('Xthree', bufname(winbufnr(3))) + + " Xone and Xtwo should be about the same height + let [wh1, wh2] = [winheight(1), winheight(2)] + call assert_inrange(wh1 - 1, wh1 + 1, wh2) + " Xtwo and Xthree should be about the same width + let [ww2, ww3] = [winwidth(2), winwidth(3)] + call assert_inrange(ww2 - 1, ww2 + 1, ww3) + + 1wincmd w + 10wincmd _ + 2wincmd w + 20wincmd | + call assert_equal(10, winheight(1)) + call assert_equal(20, winwidth(2)) + + " equalizing horizontally doesn't change the heights + hor wincmd = + call assert_equal(10, winheight(1)) + let [ww2, ww3] = [winwidth(2), winwidth(3)] + call assert_inrange(ww2 - 1, ww2 + 1, ww3) + + 2wincmd w + 20wincmd | + call assert_equal(20, winwidth(2)) + " equalizing vertically doesn't change the widths + vert wincmd = + call assert_equal(20, winwidth(2)) + let [wh1, wh2] = [winheight(1), winheight(2)] + call assert_inrange(wh1 - 1, wh1 + 1, wh2) + + bwipe Xone Xtwo Xthree +endfunc + func Test_window_width() e Xa vsplit Xb |