To: vim_dev@googlegroups.com Subject: Patch 8.2.4515 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4515 Problem: Old subsitute syntax is still supported. Solution: Disallow using backslash after ":s" in Vim9 script. Files: src/ex_cmds.c, src/errors.h, src/testdir/test_substitute.vim *** ../vim-8.2.4514/src/ex_cmds.c 2022-03-04 21:34:27.586422257 +0000 --- src/ex_cmds.c 2022-03-05 21:01:59.307930341 +0000 *************** *** 3737,3742 **** --- 3737,3747 ---- */ if (*cmd == '\\') { + if (in_vim9script()) + { + emsg(_(e_cannot_use_s_backslash_in_vim9_script)); + return; + } ++cmd; if (vim_strchr((char_u *)"/?&", *cmd) == NULL) { *** ../vim-8.2.4514/src/errors.h 2022-03-05 20:24:36.895308699 +0000 --- src/errors.h 2022-03-05 21:02:03.991921328 +0000 *************** *** 3246,3249 **** --- 3246,3251 ---- INIT(= N_("E1268: Cannot use s: in Vim9 script: %s")); EXTERN char e_cannot_create_vim9_script_variable_in_function_str[] INIT(= N_("E1269: Cannot create a Vim9 script variable in a function: %s")); + EXTERN char e_cannot_use_s_backslash_in_vim9_script[] + INIT(= N_("E1270: Cannot use :s\\/sub/ in Vim9 script")); #endif *** ../vim-8.2.4514/src/testdir/test_substitute.vim 2022-01-29 14:21:48.204942602 +0000 --- src/testdir/test_substitute.vim 2022-03-05 21:04:02.239692387 +0000 *************** *** 811,816 **** --- 811,820 ---- s\&green& call assert_equal('amber green yellow white green', getline(1)) close! + + call assert_fails('vim9cmd s\/white/', 'E1270:') + call assert_fails('vim9cmd s\?white?', 'E1270:') + call assert_fails('vim9cmd s\&white&', 'E1270:') endfunc " Test for substitute with the new text longer than the original text *** ../vim-8.2.4514/src/version.c 2022-03-05 20:24:36.899308689 +0000 --- src/version.c 2022-03-05 21:00:33.224095088 +0000 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 4515, /**/ -- I'm so disorganized my keyboard isn't even in alphabetical order! /// 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 ///