From d6711685747681e006f996893e85c998d192b2eb Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 14 Jul 2018 02:04:42 -0400 Subject: vim-patch:8.0.0890: still many old style tests Problem: Still many old style tests. Solution: Convert several tests to new style. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/75373f38087dd756babdbbf9f14fd4711712c5de --- src/nvim/testdir/test_window_cmd.vim | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/nvim/testdir/test_window_cmd.vim') diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim index 139d29a48b..d5ea52266d 100644 --- a/src/nvim/testdir/test_window_cmd.vim +++ b/src/nvim/testdir/test_window_cmd.vim @@ -417,4 +417,42 @@ func Test_window_newtab() endfunc +" Tests for adjusting window and contents +func GetScreenStr(row) + let str = "" + for c in range(1,3) + let str .= nr2char(screenchar(a:row, c)) + endfor + return str +endfunc + +func Test_window_contents() + enew! | only | new + call setline(1, range(1,256)) + + exe "norm! \t\=1Gzt\w\+" + redraw + let s3=GetScreenStr(1) + wincmd p + call assert_equal(1, line("w0")) + call assert_equal('1 ', s3) + + exe "norm! \t\=50Gzt\w\+" + redraw + let s3=GetScreenStr(1) + wincmd p + call assert_equal(50, line("w0")) + call assert_equal('50 ', s3) + + exe "norm! \t\=59Gzt\w\+" + redraw + let s3=GetScreenStr(1) + wincmd p + call assert_equal(59, line("w0")) + call assert_equal('59 ', s3) + + bwipeout! + call test_garbagecollect_now() +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From a8ff55d50eb5888ff23b8d915e2b2991cb030ffa Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 15 Jul 2018 08:36:46 -0400 Subject: vim-patch:8.0.1446: acessing freed memory after window command in auto command Problem: Acessing freed memory after window command in auto command. (gy741) Solution: Adjust the pointer in the parent frame. (Christian Brabandt, closes vim/vim#2467) https://github.com/vim/vim/commit/6f361c991221e96d5068c77b854967d997b1529b --- src/nvim/testdir/test_window_cmd.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/nvim/testdir/test_window_cmd.vim') diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim index d5ea52266d..842a6db8a2 100644 --- a/src/nvim/testdir/test_window_cmd.vim +++ b/src/nvim/testdir/test_window_cmd.vim @@ -455,4 +455,15 @@ func Test_window_contents() call test_garbagecollect_now() endfunc +func Test_access_freed_mem() + " This was accessing freed memory + au * 0 vs xxx + arg 0 + argadd + all + all + au! + bwipe xxx +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 1b3cbb39a15aa006ad3504966851352b4a5a71f2 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 15 Jul 2018 09:45:38 -0400 Subject: vim-patch:8.0.1705: when making a vertical split the mode message isn't updated Problem: When making a vertical split the mode message isn't always updated, "VISUAL" remains. (Alexei Averchenko) Solution: Only reset clear_cmdline when filling all columns of the last screen line. (Tom M. closes vim/vim#2611) https://github.com/vim/vim/commit/5bab555c2f1b3b86d57e4adeb86d908eff477fc9 --- src/nvim/testdir/test_window_cmd.vim | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/nvim/testdir/test_window_cmd.vim') diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim index 842a6db8a2..3ee96e36ca 100644 --- a/src/nvim/testdir/test_window_cmd.vim +++ b/src/nvim/testdir/test_window_cmd.vim @@ -466,4 +466,28 @@ func Test_access_freed_mem() bwipe xxx endfunc +func Test_visual_cleared_after_window_split() + new | only! + let smd_save = &showmode + set showmode + let ls_save = &laststatus + set laststatus=1 + call setline(1, ['a', 'b', 'c', 'd', '']) + norm! G + exe "norm! kkvk" + redraw + exe "norm! \v" + redraw + " check if '-- VISUAL --' disappeared from command line + let columns = range(1, &columns) + let cmdlinechars = map(columns, 'nr2char(screenchar(&lines, v:val))') + let cmdline = join(cmdlinechars, '') + let cmdline_ltrim = substitute(cmdline, '^\s*', "", "") + let mode_shown = substitute(cmdline_ltrim, '\s*$', "", "") + call assert_equal('', mode_shown) + let &showmode = smd_save + let &laststatus = ls_save + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 343c226abf519a705e8c648a8d9f04d2b93e6b77 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 15 Jul 2018 15:39:58 -0400 Subject: vim-patch:8.0.1811: no test for winrestcmd() Problem: No test for winrestcmd(). Solution: Add a test. (Dominique Pelle, closes vim/vim#2894) https://github.com/vim/vim/commit/72cf47a279f7261abf4ae6c9c3ee54024ee87a12 --- src/nvim/testdir/test_window_cmd.vim | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/nvim/testdir/test_window_cmd.vim') diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim index 3ee96e36ca..ad60c8d3c7 100644 --- a/src/nvim/testdir/test_window_cmd.vim +++ b/src/nvim/testdir/test_window_cmd.vim @@ -17,7 +17,7 @@ func Test_window_cmd_ls0_with_split() endfunc func Test_window_cmd_cmdwin_with_vsp() - let efmt='Expected 0 but got %d (in ls=%d, %s window)' + let efmt = 'Expected 0 but got %d (in ls=%d, %s window)' for v in range(0, 2) exec "set ls=" . v vsplit @@ -432,21 +432,21 @@ func Test_window_contents() exe "norm! \t\=1Gzt\w\+" redraw - let s3=GetScreenStr(1) + let s3 = GetScreenStr(1) wincmd p call assert_equal(1, line("w0")) call assert_equal('1 ', s3) exe "norm! \t\=50Gzt\w\+" redraw - let s3=GetScreenStr(1) + let s3 = GetScreenStr(1) wincmd p call assert_equal(50, line("w0")) call assert_equal('50 ', s3) exe "norm! \t\=59Gzt\w\+" redraw - let s3=GetScreenStr(1) + let s3 = GetScreenStr(1) wincmd p call assert_equal(59, line("w0")) call assert_equal('59 ', s3) @@ -490,4 +490,19 @@ func Test_visual_cleared_after_window_split() bwipe! endfunc +func Test_winrestcmd() + 2split + 3vsplit + let a = winrestcmd() + call assert_equal(2, winheight(0)) + call assert_equal(3, winwidth(0)) + wincmd = + call assert_notequal(2, winheight(0)) + call assert_notequal(3, winwidth(0)) + exe a + call assert_equal(2, winheight(0)) + call assert_equal(3, winwidth(0)) + only +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit