To: vim_dev@googlegroups.com Subject: Patch 8.2.1394 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1394 Problem: Vim9: compiling a function interferes with command modifiers. Solution: Save and restore command modifiers. (closes #6658) Files: src/vim9compile.c, src/testdir/test_vim9_func.vim, src/testdir/test_vim9_script.vim *** ../vim-8.2.1393/src/vim9compile.c 2020-08-07 22:00:22.643492517 +0200 --- src/vim9compile.c 2020-08-08 15:09:45.011275771 +0200 *************** *** 2668,2674 **** cctx->ctx_line_start = line; SOURCING_LNUM = cctx->ctx_lnum + 1; } while (line == NULL || *skipwhite(line) == NUL ! || (skip_comment && vim9_comment_start(skipwhite(line)))); return line; } --- 2668,2674 ---- cctx->ctx_line_start = line; SOURCING_LNUM = cctx->ctx_lnum + 1; } while (line == NULL || *skipwhite(line) == NUL ! || (skip_comment && vim9_comment_start(skipwhite(line)))); return line; } *************** *** 7194,7203 **** */ for (;;) { ! exarg_T ea; ! int starts_with_colon = FALSE; ! char_u *cmd; ! int save_msg_scroll = msg_scroll; // Bail out on the first error to avoid a flood of errors and report // the right line number when inside try/catch. --- 7194,7204 ---- */ for (;;) { ! exarg_T ea; ! cmdmod_T save_cmdmod; ! int starts_with_colon = FALSE; ! char_u *cmd; ! int save_msg_scroll = msg_scroll; // Bail out on the first error to avoid a flood of errors and report // the right line number when inside try/catch. *************** *** 7278,7283 **** --- 7279,7285 ---- /* * COMMAND MODIFIERS */ + save_cmdmod = cmdmod; if (parse_command_modifiers(&ea, &errormsg, FALSE) == FAIL) { if (errormsg != NULL) *************** *** 7288,7294 **** } // TODO: use modifiers in the command undo_cmdmod(&ea, save_msg_scroll); ! CLEAR_FIELD(cmdmod); // Skip ":call" to get to the function name. if (checkforcmd(&ea.cmd, "call", 3)) --- 7290,7296 ---- } // TODO: use modifiers in the command undo_cmdmod(&ea, save_msg_scroll); ! cmdmod = save_cmdmod; // Skip ":call" to get to the function name. if (checkforcmd(&ea.cmd, "call", 3)) *** ../vim-8.2.1393/src/testdir/test_vim9_func.vim 2020-08-08 14:26:27.640478505 +0200 --- src/testdir/test_vim9_func.vim 2020-08-08 15:08:10.127734936 +0200 *************** *** 1351,1355 **** --- 1351,1380 ---- assert_equal({'title': 'test'}, getqflist({'title': 1})) enddef + def Test_cmd_modifier() + tab echo '0' + call CheckDefFailure(['5tab echo 3'], 'E16:') + enddef + + def Test_restore_modifiers() + # check that when compiling a :def function command modifiers are not messed + # up. + let lines =<< trim END + vim9script + set eventignore= + autocmd QuickFixCmdPost * copen + def AutocmdsDisabled() + eval 0 + enddef + func Func() + noautocmd call s:AutocmdsDisabled() + let g:ei_after = &eventignore + endfunc + Func() + END + CheckScriptSuccess(lines) + assert_equal('', g:ei_after) + enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker *** ../vim-8.2.1393/src/testdir/test_vim9_script.vim 2020-08-07 22:00:22.643492517 +0200 --- src/testdir/test_vim9_script.vim 2020-08-08 15:08:06.223753963 +0200 *************** *** 751,761 **** call CheckDefFailure(['{', 'echo 1'], 'E1026:') endfunc - def Test_cmd_modifier() - tab echo '0' - call CheckDefFailure(['5tab echo 3'], 'E16:') - enddef - func g:NoSuchFunc() echo 'none' endfunc --- 751,756 ---- *** ../vim-8.2.1393/src/version.c 2020-08-08 14:41:49.436991505 +0200 --- src/version.c 2020-08-08 15:03:09.793240060 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1394, /**/ -- hundred-and-one symptoms of being an internet addict: 151. You find yourself engaged to someone you've never actually met, except through e-mail. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///