Mercurial > vim
changeset 27440:1118a65c9bc7
patch 8.2.4248: no proper test for moving the window separator
Commit: https://github.com/vim/vim/commit/a0c4e2f2d7aa164d9d7692702c752ea063bd3a8c
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat Jan 29 10:59:53 2022 +0000
patch 8.2.4248: no proper test for moving the window separator
Problem: No proper test for moving the window separator.
Solution: Add a test. Add comment in code. (closes https://github.com/vim/vim/issues/9656)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 29 Jan 2022 12:00:06 +0100 |
parents | 996b7602c7fa |
children | 674240fcf6de |
files | src/testdir/test_window_cmd.vim src/version.c src/window.c |
diffstat | 3 files changed, 24 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -1424,6 +1424,12 @@ func Test_win_move_separator() call assert_true(id->win_move_separator(-offset)) call assert_equal(w, winwidth(id)) endfor + " check win_move_separator from right window on right window is no-op + let w0 = winwidth(0) + call assert_true(win_move_separator(0, 1)) + call assert_equal(w0, winwidth(0)) + call assert_true(win_move_separator(0, -1)) + call assert_equal(w0, winwidth(0)) " check that win_move_separator doesn't error with offsets beyond moving " possibility call assert_true(win_move_separator(id, 5000)) @@ -1465,6 +1471,19 @@ func Test_win_move_statusline() call assert_true(win_move_statusline(1, -offset)) call assert_equal(h, winheight(1)) endfor + " check win_move_statusline from bottom window on bottom window + let h0 = winheight(0) + for offset in range(5) + call assert_true(0->win_move_statusline(-offset)) + call assert_equal(h0 - offset, winheight(0)) + call assert_equal(1 + offset, &cmdheight) + call assert_true(win_move_statusline(0, offset)) + call assert_equal(h0, winheight(0)) + call assert_equal(1, &cmdheight) + endfor + call assert_true(win_move_statusline(0, 1)) + call assert_equal(h0, winheight(0)) + call assert_equal(1, &cmdheight) " check win_move_statusline from bottom window on top window ID let id = win_getid(1) for offset in range(5)
--- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4248, +/**/ 4247, /**/ 4246,
--- a/src/window.c +++ b/src/window.c @@ -6187,7 +6187,9 @@ win_drag_vsep_line(win_T *dragwin, int o if (offset <= 0) // No room at all, quit. return; if (fr == NULL) - return; // Safety check, should not happen. + // This can happen when calling win_move_separator() on the rightmost + // window. Just don't do anything. + return; // grow frame fr by offset lines frame_new_width(fr, fr->fr_width + offset, left, FALSE);