To: vim_dev@googlegroups.com Subject: Patch 8.2.3829 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3829 Problem: No error when setting a func option to a script-local function. Solution: Give an error if the name starts with "s:". (closes #9358) Files: src/option.c, src/testdir/test_tagfunc.vim, src/testdir/dumps/Test_set_tagfunc_on_cmdline.dump *** ../vim-8.2.3828/src/option.c 2021-12-14 09:01:35.200116814 +0000 --- src/option.c 2021-12-16 19:09:52.171089414 +0000 *************** *** 7199,7204 **** --- 7199,7207 ---- return OK; } + if (STRNCMP(optval, "s:", 2) == 0 && !SCRIPT_ID_VALID(current_sctx.sc_sid)) + return FAIL; + if (*optval == '{' || (in_vim9script() && *optval == '(') || (STRNCMP(optval, "function(", 9) == 0) || (STRNCMP(optval, "funcref(", 8) == 0)) *** ../vim-8.2.3828/src/testdir/test_tagfunc.vim 2021-12-12 20:07:58.724337327 +0000 --- src/testdir/test_tagfunc.vim 2021-12-16 19:26:56.308526924 +0000 *************** *** 1,6 **** --- 1,8 ---- " Test 'tagfunc' source vim9.vim + source check.vim + source screendump.vim func TagFunc(pat, flag, info) let g:tagfunc_args = [a:pat, a:flag, a:info] *************** *** 342,345 **** --- 344,356 ---- %bw! endfunc + func Test_set_tagfunc_on_cmdline() + CheckScreendump + + let buf = RunVimInTerminal(' +"set tagfunc=s:Func"', #{rows: 6, wait_for_ruler: 0}) + call VerifyScreenDump(buf, 'Test_set_tagfunc_on_cmdline', {}) + call StopVimInTerminal(buf) + endfunc + + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.3828/src/testdir/dumps/Test_set_tagfunc_on_cmdline.dump 2021-12-16 19:45:05.896011296 +0000 --- src/testdir/dumps/Test_set_tagfunc_on_cmdline.dump 2021-12-16 19:27:01.000526536 +0000 *************** *** 0 **** --- 1,6 ---- + | +0&#ffffff0@74 + @75 + @75 + |E+0#ffffff16#e000002|r@1|o|r| |d|e|t|e|c|t|e|d| |w|h|i|l|e| |p|r|o|c|e|s@1|i|n|g| |c|o|m@1|a|n|d| |l|i|n|e|:| +0#0000000#ffffff0@29 + |E+0#ffffff16#e000002|4|7|4|:| |I|n|v|a|l|i|d| |a|r|g|u|m|e|n|t|:| |t|a|g|f|u|n|c|=|s|:|F|u|n|c| +0#0000000#ffffff0@36 + |P+0#00e0003&|r|e|s@1| |E|N|T|E|R| |o|r| |t|y|p|e| |c|o|m@1|a|n|d| |t|o| |c|o|n|t|i|n|u|e> +0#0000000&@35 *** ../vim-8.2.3828/src/version.c 2021-12-16 18:02:03.363882332 +0000 --- src/version.c 2021-12-16 18:59:59.319526509 +0000 *************** *** 751,752 **** --- 751,754 ---- { /* Add new patch number below this line */ + /**/ + 3829, /**/ -- hundred-and-one symptoms of being an internet addict: 45. You buy a Captain Kirk chair with a built-in keyboard and mouse. /// 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 ///