Problem: Old subsitute syntax is still supported.
Solution: Disallow using backslash after ":s" in Vim9 script.
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
*/
if (*cmd == '\\')
{
+ if (in_vim9script())
+ {
+ emsg(_(e_cannot_use_s_backslash_in_vim9_script));
+ return;
+ }
++cmd;
if (vim_strchr((char_u *)"/?&", *cmd) == NULL)
{
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
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 4515,
/**/
4514,
/**/