To: vim_dev@googlegroups.com Subject: Patch 8.2.4248 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4248 Problem: No proper test for moving the window separator. Solution: Add a test. Add comment in code. (closes #9656) Files: src/window.c, src/testdir/test_window_cmd.vim *** ../vim-8.2.4247/src/window.c 2022-01-28 15:28:00.216927600 +0000 --- src/window.c 2022-01-29 10:54:53.674796636 +0000 *************** *** 6187,6193 **** if (offset <= 0) // No room at all, quit. return; if (fr == NULL) ! return; // Safety check, should not happen. // grow frame fr by offset lines frame_new_width(fr, fr->fr_width + offset, left, FALSE); --- 6187,6195 ---- if (offset <= 0) // No room at all, quit. return; if (fr == NULL) ! // 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); *** ../vim-8.2.4247/src/testdir/test_window_cmd.vim 2022-01-10 13:36:31.264892417 +0000 --- src/testdir/test_window_cmd.vim 2022-01-29 10:54:53.674796636 +0000 *************** *** 1424,1429 **** --- 1424,1435 ---- 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,1470 **** --- 1471,1489 ---- 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) *** ../vim-8.2.4247/src/version.c 2022-01-29 10:51:54.949759202 +0000 --- src/version.c 2022-01-29 10:58:24.015309957 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4248, /**/ -- THEOREM: VI is perfect. PROOF: VI in roman numerals is 6. The natural numbers < 6 which divide 6 are 1, 2, and 3. 1+2+3 = 6. So 6 is a perfect number. Therefore, VI is perfect. QED -- Arthur Tateishi /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///