From 3b04ba7544cf78ab4d9e7e9ee4536a2e7a916fe6 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 26 Mar 2021 18:41:59 -0400 Subject: vim-patch:8.2.2655: The -w command line argument doesn't work Problem: The -w command line argument doesn't work. Solution: Don't set 'window' when set with the -w argument. (closes vim/vim#8011) https://github.com/vim/vim/commit/0a1a6a1aa4004d0e4d64cc375540156b8bd92a87 Cherry-pick Test_w_arg() from patch v8.2.0509. --- src/nvim/screen.c | 5 +++-- src/nvim/testdir/test_startup.vim | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 1e20b77c5c..760a54a316 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -7609,8 +7609,9 @@ void win_new_shellsize(void) static long old_Columns = 0; if (old_Rows != Rows) { - // if 'window' uses the whole screen, keep it using that */ - if (p_window == old_Rows - 1 || old_Rows == 0) { + // If 'window' uses the whole screen, keep it using that. + // Don't change it when set with "-w size" on the command line. + if (p_window == old_Rows - 1 || (old_Rows == 0 && p_window == 0)) { p_window = Rows - 1; } old_Rows = Rows; diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index eb9378194f..63affd6910 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -890,6 +890,36 @@ func Test_not_a_term() endfunc +" Test for the "-w scriptout" argument +func Test_w_arg() + " Can't catch the output of gvim. + CheckNotGui + + call writefile(["iVim Editor\:q!\"], 'Xscriptin', 'b') + if RunVim([], [], '-s Xscriptin -w Xscriptout') + call assert_equal(["iVim Editor\e:q!\r"], readfile('Xscriptout')) + call delete('Xscriptout') + endif + call delete('Xscriptin') + + " Test for failing to open the script output file. This test works only when + " the language is English. + if v:lang == "C" || v:lang =~ '^[Ee]n' + call mkdir("Xdir") + let m = system(GetVimCommand() .. " -w Xdir") + call assert_equal("Cannot open for script output: \"Xdir\"\n", m) + call delete("Xdir", 'rf') + endif + + " A number argument sets the 'window' option + call writefile(["iwindow \=&window\\:wq! Xresult\"], 'Xscriptin', 'b') + if RunVim([], [], '-s Xscriptin -w 17') + call assert_equal(["window 17"], readfile('Xresult')) + call delete('Xresult') + endif + call delete('Xscriptin') +endfunc + " Test starting vim with various names: vim, ex, view, evim, etc. func Test_progname() CheckUnix -- cgit From 3784827f8df9a324c395a0589d12fc80f4eea2d3 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 26 Mar 2021 19:23:51 -0400 Subject: vim-patch:8.2.2656: some command line arguments and regexp errors not tested MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Some command line arguments and regexp errors not tested. Solution: Add a few test cases. (Dominique Pellé, closes vim/vim#8013) https://github.com/vim/vim/commit/a2b3e7dc9201fb3d8782c6b4ab53862160e254da Cherry-pick Test_t_arg() from patch v8.2.0509. --- src/nvim/testdir/test_startup.vim | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index 63affd6910..744fae4e60 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -814,6 +814,34 @@ func Test_v_argv() call assert_equal(['arg1', '--cmd', 'echo v:argv', '--cmd', 'q'']'], list[idx:]) endfunc +" Test for the '-t' option to jump to a tag +func Test_t_arg() + let before =<< trim [CODE] + set tags=Xtags + [CODE] + let after =<< trim [CODE] + let s = bufname('') .. ':L' .. line('.') .. 'C' .. col('.') + call writefile([s], "Xtestout") + qall + [CODE] + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "first\tXfile1\t/^ \\zsfirst$/", + \ "second\tXfile1\t/^ \\zssecond$/", + \ "third\tXfile1\t/^ \\zsthird$/"], + \ 'Xtags') + call writefile([' first', ' second', ' third'], 'Xfile1') + + for t_arg in ['-t second', '-tsecond'] + if RunVim(before, after, '-t second') + call assert_equal(['Xfile1:L2C5'], readfile('Xtestout'), t_arg) + call delete('Xtestout') + endif + endfor + + call delete('Xtags') + call delete('Xfile1') +endfunc + " Test the '-T' argument which sets the 'term' option. func Test_T_arg() throw 'skipped: Nvim does not support "-T" argument' @@ -913,10 +941,12 @@ func Test_w_arg() " A number argument sets the 'window' option call writefile(["iwindow \=&window\\:wq! Xresult\"], 'Xscriptin', 'b') - if RunVim([], [], '-s Xscriptin -w 17') - call assert_equal(["window 17"], readfile('Xresult')) - call delete('Xresult') - endif + for w_arg in ['-w 17', '-w17'] + if RunVim([], [], '-s Xscriptin ' .. w_arg) + call assert_equal(["window 17"], readfile('Xresult'), w_arg) + call delete('Xresult') + endif + endfor call delete('Xscriptin') endfunc -- cgit From 6e9e8eb38290925a03f75dc8f2b261045c3870e4 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 1 Apr 2021 08:31:03 -0400 Subject: test/old/win: debug Test_w_arg --- src/nvim/testdir/test_startup.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index 744fae4e60..e0dc0e0075 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -932,7 +932,7 @@ func Test_w_arg() " Test for failing to open the script output file. This test works only when " the language is English. - if v:lang == "C" || v:lang =~ '^[Ee]n' + if !has('win32') && (v:lang == "C" || v:lang =~ '^[Ee]n') call mkdir("Xdir") let m = system(GetVimCommand() .. " -w Xdir") call assert_equal("Cannot open for script output: \"Xdir\"\n", m) -- cgit