diff --git a/src/nvim/normal.c b/src/nvim/normal.c index a842bb20a9..64bc868cb5 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3485,7 +3485,8 @@ void scroll_redraw(int up, long count) redraw_later(curwin, VALID); } -/// Get the count specified after a 'z' command. +/// Get the count specified after a 'z' command. Only the 'z', 'zl', 'zh', +/// 'z', and 'z' commands accept a count after 'z'. /// @return true to process the 'z' command and false to skip it. static bool nv_z_get_count(cmdarg_T *cap, int *nchar_arg) { diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 8c20c647f1..007b7e0f14 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -1332,4 +1332,50 @@ func Test_diff_binary() set diffopt&vim endfunc +" Test for using the 'zi' command to invert 'foldenable' in diff windows (test +" for the issue fixed by patch 6.2.317) +func Test_diff_foldinvert() + %bw! + edit Xfile1 + new Xfile2 + new Xfile3 + windo diffthis + " open a non-diff window + botright new + 1wincmd w + call assert_true(getwinvar(1, '&foldenable')) + call assert_true(getwinvar(2, '&foldenable')) + call assert_true(getwinvar(3, '&foldenable')) + normal zi + call assert_false(getwinvar(1, '&foldenable')) + call assert_false(getwinvar(2, '&foldenable')) + call assert_false(getwinvar(3, '&foldenable')) + normal zi + call assert_true(getwinvar(1, '&foldenable')) + call assert_true(getwinvar(2, '&foldenable')) + call assert_true(getwinvar(3, '&foldenable')) + + " If the current window has 'noscrollbind', then 'zi' should not change + " 'foldenable' in other windows. + 1wincmd w + set noscrollbind + normal zi + call assert_false(getwinvar(1, '&foldenable')) + call assert_true(getwinvar(2, '&foldenable')) + call assert_true(getwinvar(3, '&foldenable')) + + " 'zi' should not change the 'foldenable' for windows with 'noscrollbind' + 1wincmd w + set scrollbind + normal zi + call setwinvar(2, '&scrollbind', v:false) + normal zi + call assert_false(getwinvar(1, '&foldenable')) + call assert_true(getwinvar(2, '&foldenable')) + call assert_false(getwinvar(3, '&foldenable')) + + %bw! + set scrollbind& +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim index ffa0cd1807..f18ddb274c 100644 --- a/src/nvim/testdir/test_normal.vim +++ b/src/nvim/testdir/test_normal.vim @@ -580,6 +580,7 @@ endfunc func Test_normal_z_error() call assert_beeps('normal! z2p') call assert_beeps('normal! zq') + call assert_beeps('normal! cz1') endfunc func Test_normal15_z_scroll_vert() @@ -619,7 +620,7 @@ func Test_normal15_z_scroll_vert() call assert_equal(10, winheight(0)) exe "norm! z12\" call assert_equal(12, winheight(0)) - exe "norm! z10\" + exe "norm! z15\0\" call assert_equal(10, winheight(0)) " Test for z.