comparison src/autocmd.c @ 27960:be693de40634 v8.2.4505

patch 8.2.4505: Vim9: outdated "autocmd nested" still works Commit: https://github.com/vim/vim/commit/f07751457c39a645009c17cd837131f6bcdd7d55 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Mar 4 20:10:38 2022 +0000 patch 8.2.4505: Vim9: outdated "autocmd nested" still works Problem: Vim9: outdated "autocmd nested" still works. Solution: Do not accept the :autocmd argument "nested" without "++" in Vim9 script.
author Bram Moolenaar <Bram@vim.org>
date Fri, 04 Mar 2022 21:15:02 +0100
parents c1d1639b52dd
children e466fdbe0699
comparison
equal deleted inserted replaced
27959:ec56a659a69a 27960:be693de40634
919 919
920 // Check for "++nested" flag. 920 // Check for "++nested" flag.
921 if ((STRNCMP(cmd, "++nested", 8) == 0 && VIM_ISWHITE(cmd[8]))) 921 if ((STRNCMP(cmd, "++nested", 8) == 0 && VIM_ISWHITE(cmd[8])))
922 { 922 {
923 if (nested) 923 if (nested)
924 {
924 semsg(_(e_duplicate_argument_str), "++nested"); 925 semsg(_(e_duplicate_argument_str), "++nested");
926 return;
927 }
925 nested = TRUE; 928 nested = TRUE;
926 cmd = skipwhite(cmd + 8); 929 cmd = skipwhite(cmd + 8);
927 } 930 }
928 931
929 // Check for the old "nested" flag. 932 // Check for the old "nested" flag in legacy script.
930 if (STRNCMP(cmd, "nested", 6) == 0 && VIM_ISWHITE(cmd[6])) 933 if (STRNCMP(cmd, "nested", 6) == 0 && VIM_ISWHITE(cmd[6]))
931 { 934 {
935 if (in_vim9script())
936 {
937 // If there ever is a :nested command this error should
938 // be removed and "nested" accepted as the start of the
939 // command.
940 emsg(_(e_invalid_command_nested_did_you_mean_plusplus_nested));
941 return;
942 }
932 if (nested) 943 if (nested)
944 {
933 semsg(_(e_duplicate_argument_str), "nested"); 945 semsg(_(e_duplicate_argument_str), "nested");
946 return;
947 }
934 nested = TRUE; 948 nested = TRUE;
935 cmd = skipwhite(cmd + 6); 949 cmd = skipwhite(cmd + 6);
936 } 950 }
937 } 951 }
938 } 952 }