From 52778d62fcf6521f9a2b844340951247599b7936 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Jan 2018 11:42:49 +0100 Subject: vim-patch:8.0.0654: no warning for text after :endfunction Problem: Text found after :endfunction is silently ignored. Solution: Give a warning if 'verbose' is set. When | or \n are used, execute the text as a command. https://github.com/vim/vim/commit/663bb2331626944cea156374858131fcd323b9e9 Note: the code part of this patch was addressed by 60c025267265. --- src/nvim/testdir/test_vimscript.vim | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/nvim/testdir/test_vimscript.vim b/src/nvim/testdir/test_vimscript.vim index 4e0f1bbd2f..78fe62bc63 100644 --- a/src/nvim/testdir/test_vimscript.vim +++ b/src/nvim/testdir/test_vimscript.vim @@ -1215,6 +1215,33 @@ func Test_bitwise_functions() call assert_fails("call invert({})", 'E728:') endfunc +" Test trailing text after :endfunction {{{1 +func Test_endfunction_trailing() + call assert_false(exists('*Xtest')) + + exe "func Xtest()\necho 'hello'\nendfunc\nlet done = 'yes'" + call assert_true(exists('*Xtest')) + call assert_equal('yes', done) + delfunc Xtest + unlet done + + exe "func Xtest()\necho 'hello'\nendfunc|let done = 'yes'" + call assert_true(exists('*Xtest')) + call assert_equal('yes', done) + delfunc Xtest + unlet done + + set verbose=1 + exe "func Xtest()\necho 'hello'\nendfunc \" garbage" + call assert_true(exists('*Xtest')) + delfunc Xtest + + call assert_fails("func Xtest()\necho 'hello'\nendfunc garbage", 'E946') + call assert_true(exists('*Xtest')) + delfunc Xtest + set verbose=0 +endfunc + "------------------------------------------------------------------------------- " Modelines {{{1 " vim: ts=8 sw=4 tw=80 fdm=marker -- cgit From a185ab70fd2eb8d55f1156cf7d5513338a309917 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Jan 2018 11:45:11 +0100 Subject: vim-patch:8.0.0655: not easy to make sure a function does not exist Problem: Not easy to make sure a function does not exist. Solution: Add ! as an optional argument to :delfunc. https://github.com/vim/vim/commit/d6abcd154cdc6a8dd4b7c6ccad37617ea8a1b4aa --- src/nvim/eval.c | 4 +++- src/nvim/ex_cmds.lua | 2 +- src/nvim/testdir/test_vimscript.vim | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 28c590c0b4..48525c2891 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -20863,7 +20863,9 @@ void ex_delfunction(exarg_T *eap) if (!eap->skip) { if (fp == NULL) { - EMSG2(_(e_nofunc), eap->arg); + if (!eap->forceit) { + EMSG2(_(e_nofunc), eap->arg); + } return; } if (fp->uf_calls > 0) { diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua index e57e662039..c8593f7460 100644 --- a/src/nvim/ex_cmds.lua +++ b/src/nvim/ex_cmds.lua @@ -692,7 +692,7 @@ return { }, { command='delcommand', - flags=bit.bor(NEEDARG, WORD1, TRLBAR, CMDWIN), + flags=bit.bor(BANG, NEEDARG, WORD1, TRLBAR, CMDWIN), addr_type=ADDR_LINES, func='ex_delcommand', }, diff --git a/src/nvim/testdir/test_vimscript.vim b/src/nvim/testdir/test_vimscript.vim index 78fe62bc63..f48b33e4d1 100644 --- a/src/nvim/testdir/test_vimscript.vim +++ b/src/nvim/testdir/test_vimscript.vim @@ -1242,6 +1242,16 @@ func Test_endfunction_trailing() set verbose=0 endfunc +func Test_delfunction_force() + delfunc! Xtest + delfunc! Xtest + func Xtest() + echo 'nothing' + endfunc + delfunc! Xtest + delfunc! Xtest +endfunc + "------------------------------------------------------------------------------- " Modelines {{{1 " vim: ts=8 sw=4 tw=80 fdm=marker -- cgit From a5d33d5e904d217d84171d7edcbb640cca73303a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Jan 2018 11:55:27 +0100 Subject: vim-patch:8.0.0656: cannot use ! after some user commands [Test passes, and the code change doesn't look applicable. So this only includes the test.] Problem: Cannot use ! after some user commands. Solution: Properly check for existing command. (Higashi Higashi) https://github.com/vim/vim/commit/6f9a476b2f2f0bb5c50d703ec4fc535ffd5bfe8f --- src/nvim/testdir/test_vimscript.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/nvim/testdir/test_vimscript.vim b/src/nvim/testdir/test_vimscript.vim index f48b33e4d1..b18c2f5a85 100644 --- a/src/nvim/testdir/test_vimscript.vim +++ b/src/nvim/testdir/test_vimscript.vim @@ -1252,6 +1252,15 @@ func Test_delfunction_force() delfunc! Xtest endfunc +" Test using bang after user command {{{1 +func Test_user_command_with_bang() + command -bang Nieuw let nieuw = 1 + Ni! + call assert_equal(1, nieuw) + unlet nieuw + delcommand Nieuw +endfunc + "------------------------------------------------------------------------------- " Modelines {{{1 " vim: ts=8 sw=4 tw=80 fdm=marker -- cgit From 154822933ee29f7b27157ff6e5138d8126cfc27f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Jan 2018 11:27:17 +0100 Subject: vim-patch:8.0.0659: no test for conceal mode Problem: No test for conceal mode. Solution: Add a conceal mode test. (Dominique Pelle, closes vim/vim#1783) https://github.com/vim/vim/commit/4d785895d1f8b54cdd3fabd87446ca692f49e94e --- runtime/doc/eval.txt | 25 ++++++++++++---------- src/nvim/eval.c | 4 ++-- src/nvim/testdir/test_syntax.vim | 45 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 13 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 7820b85bf4..8771604c89 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -7602,17 +7602,20 @@ synIDtrans({synID}) *synIDtrans()* ":highlight link" are followed. synconcealed({lnum}, {col}) *synconcealed()* - The result is a List. The first item in the list is 0 if the - character at the position {lnum} and {col} is not part of a - concealable region, 1 if it is. The second item in the list is - a string. If the first item is 1, the second item contains the - text which will be displayed in place of the concealed text, - depending on the current setting of 'conceallevel'. The third - and final item in the list is a unique number representing the - specific syntax region matched. This allows detection of the - beginning of a new concealable region if there are two - consecutive regions with the same replacement character. - For an example use see $VIMRUNTIME/syntax/2html.vim . + The result is a List with currently three items: + 1. The first item in the list is 0 if the character at the + position {lnum} and {col} is not part of a concealable + region, 1 if it is. + 2. The second item in the list is a string. If the first item + is 1, the second item contains the text which will be + displayed in place of the concealed text, depending on the + current setting of 'conceallevel' and 'listchars'. + 3. The third and final item in the list is a unique number + representing the specific syntax region matched. This + allows detection of the beginning of a new concealable + region if there are two consecutive regions with the same + replacement character. For an example use see + $VIMRUNTIME/syntax/2html.vim . synstack({lnum}, {col}) *synstack()* diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 48525c2891..f663d13c55 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -16274,8 +16274,8 @@ static void f_synconcealed(typval_T *argvars, typval_T *rettv, FunPtr fptr) // get the conceal character if ((syntax_flags & HL_CONCEAL) && curwin->w_p_cole < 3) { cchar = syn_get_sub_char(); - if (cchar == NUL && curwin->w_p_cole == 1 && lcs_conceal != NUL) { - cchar = lcs_conceal; + if (cchar == NUL && curwin->w_p_cole == 1) { + cchar = (lcs_conceal == NUL) ? ' ' : lcs_conceal; } if (cchar != NUL) { utf_char2bytes(cchar, str); diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim index 6456ca2b23..21af5d1972 100644 --- a/src/nvim/testdir/test_syntax.vim +++ b/src/nvim/testdir/test_syntax.vim @@ -1,5 +1,7 @@ " Test for syntax and syntax iskeyword option +source view_util.vim + func GetSyntaxItem(pat) let c = '' let a = ['a', getreg('a'), getregtype('a')] @@ -340,3 +342,46 @@ func Test_invalid_name() hi clear Nop hi clear @Wrong endfunc + + +func Test_conceal() + if !has('conceal') + return + endif + + new + call setline(1, ['', '123456']) + syn match test23 "23" conceal cchar=X + syn match test45 "45" conceal + + set conceallevel=0 + call assert_equal('123456 ', ScreenLines(2, 7)[0]) + call assert_equal([[0, ''], [0, ''], [0, ''], [0, ''], [0, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]')) + + set conceallevel=1 + call assert_equal('1X 6 ', ScreenLines(2, 7)[0]) + " FIXME: with conceallevel=1, I would expect that the portion "45" of + " the line to be replaced with a space since ":help 'conceallevel' + " states that if listchars is not set, then the default replacement + " should be a space. But synconcealed() gives an empty string in + " the 2nd value of the returned list. Bug? + " So for now, the following line is commented out: + call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, ' '], [1, ' '], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]')) + + set conceallevel=1 + set listchars=conceal:Y + call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, 'Y'], [1, 'Y'], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]')) + call assert_equal('1XY6 ', ScreenLines(2, 7)[0]) + + set conceallevel=2 + call assert_match('1X6 ', ScreenLines(2, 7)[0]) + call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, ''], [1, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]')) + + set conceallevel=3 + call assert_match('16 ', ScreenLines(2, 7)[0]) + call assert_equal([[0, ''], [1, ''], [1, ''], [1, ''], [1, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]')) + + syn clear + set conceallevel& + bw! +endfunc -- cgit From fb855feb525c25bd0c3523c2e518228886535f2f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Jan 2018 11:34:06 +0100 Subject: vim-patch:8.0.0662: stray FIXME for fixed problem Problem: Stray FIXME for fixed problem. Solution: Remove the comment. (Dominique Pelle) https://github.com/vim/vim/commit/4670490673ed98502a09b74fbabe785b47e3d289 --- src/nvim/testdir/test_syntax.vim | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim index 21af5d1972..366a6ee1e2 100644 --- a/src/nvim/testdir/test_syntax.vim +++ b/src/nvim/testdir/test_syntax.vim @@ -360,12 +360,6 @@ func Test_conceal() set conceallevel=1 call assert_equal('1X 6 ', ScreenLines(2, 7)[0]) - " FIXME: with conceallevel=1, I would expect that the portion "45" of - " the line to be replaced with a space since ":help 'conceallevel' - " states that if listchars is not set, then the default replacement - " should be a space. But synconcealed() gives an empty string in - " the 2nd value of the returned list. Bug? - " So for now, the following line is commented out: call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, ' '], [1, ' '], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]')) set conceallevel=1 -- cgit From d6cbe6ca875f0f20b02a373b6d039328f402a2c4 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Jan 2018 12:16:55 +0100 Subject: vim-patch:8.0.0667: more tests for :endfunc [Only the test is merged; code was addressed by 60c025267265.] Problem: Memory access error when command follows :endfunction. (Nikolai Pavlov) Solution: Make memory handling in :function straightforward. (closes vim/vim#1793) https://github.com/vim/vim/commit/53564f7c1a2998d92568e07fff1f2a4c1cecb646 --- src/nvim/testdir/test_vimscript.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/nvim/testdir/test_vimscript.vim b/src/nvim/testdir/test_vimscript.vim index b18c2f5a85..c449fc91b0 100644 --- a/src/nvim/testdir/test_vimscript.vim +++ b/src/nvim/testdir/test_vimscript.vim @@ -1231,6 +1231,11 @@ func Test_endfunction_trailing() delfunc Xtest unlet done + " trailing line break + exe "func Xtest()\necho 'hello'\nendfunc\n" + call assert_true(exists('*Xtest')) + delfunc Xtest + set verbose=1 exe "func Xtest()\necho 'hello'\nendfunc \" garbage" call assert_true(exists('*Xtest')) @@ -1240,6 +1245,11 @@ func Test_endfunction_trailing() call assert_true(exists('*Xtest')) delfunc Xtest set verbose=0 + + function Foo() + echo 'hello' + endfunction | echo 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' + delfunc Foo endfunc func Test_delfunction_force() -- cgit From 872ee4259aa0c3babcc532c2aa1ccef6f7693221 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Jan 2018 12:26:21 +0100 Subject: vim-patch: NA vim-patch:8.0.0674: cannot build with eval but without timers vim-patch:8.0.0673: build failure without conceal feature vim-patch:8.0.0668: nsis installer script does not work vim-patch:8.0.0666: dead for loop vim-patch:8.0.0665: warning for uninitialized variable vim-patch:8.0.0664: mouse does not work in tmux vim-patch:8.0.0661: recognizing urxvt mouse codes does not work well vim-patch:8.0.0660: silent install on MS-Windows shows dialog --- src/nvim/version.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nvim/version.c b/src/nvim/version.c index fd6347282d..ed6dc0fb2a 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -1498,6 +1498,7 @@ static const int included_patches[] = { 2, 1, 0, + }; // clang-format on -- cgit