diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-08-23 12:20:37 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-08-23 17:48:12 +0800 |
| commit | d0b9fe2d5a95def67acc83f713b932f3f12dea08 (patch) | |
| tree | 3c21b8d776e099c1f55c25a6593ccb3cbf1a9f7a /src/nvim/testdir | |
| parent | 7afc17dec17bcc40c646b796f05d373e46916dd7 (diff) | |
| download | rneovim-d0b9fe2d5a95def67acc83f713b932f3f12dea08.tar.gz rneovim-d0b9fe2d5a95def67acc83f713b932f3f12dea08.tar.bz2 rneovim-d0b9fe2d5a95def67acc83f713b932f3f12dea08.zip | |
vim-patch:8.2.4749: <script> is not expanded in autocmd context
Problem: <script> is not expanded in autocmd context.
Solution: Add the context to the pattern struct. (closes vim/vim#10144)
Rename AutoPatCmd to AutoPatCmd_T.
https://github.com/vim/vim/commit/eca7c60d68e63001dbe3c8e5d240b0895e607fc3
Omit AutoPatCmd -> AutoPatCmd_T rename as it is inconsistent.
Use `.sn_name` instead of `->sn_name` as v8.2.0154 hasn't been ported.
Omit acp_script_stx(), use member directly.
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_expand.vim | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/nvim/testdir/test_expand.vim b/src/nvim/testdir/test_expand.vim index 6579e09d5e..aa131a49ff 100644 --- a/src/nvim/testdir/test_expand.vim +++ b/src/nvim/testdir/test_expand.vim @@ -157,43 +157,52 @@ endfunc func Test_expand_script_source() let lines0 =<< trim [SCRIPT] - let g:script_level[0] = expand('<script>:t') + call extend(g:script_level, [expand('<script>:t')]) so Xscript1 func F0() - let g:func_level[0] = expand('<script>:t') + call extend(g:func_level, [expand('<script>:t')]) endfunc + + au User * call extend(g:au_level, [expand('<script>:t')]) [SCRIPT] let lines1 =<< trim [SCRIPT] - let g:script_level[1] = expand('<script>:t') + call extend(g:script_level, [expand('<script>:t')]) so Xscript2 func F1() - let g:func_level[1] = expand('<script>:t') + call extend(g:func_level, [expand('<script>:t')]) endfunc + + au User * call extend(g:au_level, [expand('<script>:t')]) [SCRIPT] let lines2 =<< trim [SCRIPT] - let g:script_level[2] = expand('<script>:t') + call extend(g:script_level, [expand('<script>:t')]) func F2() - let g:func_level[2] = expand('<script>:t') + call extend(g:func_level, [expand('<script>:t')]) endfunc + + au User * call extend(g:au_level, [expand('<script>:t')]) [SCRIPT] call writefile(lines0, 'Xscript0') call writefile(lines1, 'Xscript1') call writefile(lines2, 'Xscript2') - " Check the expansion of <script> at script and function level. - let g:script_level = ['', '', ''] - let g:func_level = ['', '', ''] + " Check the expansion of <script> at different levels. + let g:script_level = [] + let g:func_level = [] + let g:au_level = [] so Xscript0 call F0() call F1() call F2() + doautocmd User call assert_equal(['Xscript0', 'Xscript1', 'Xscript2'], g:script_level) call assert_equal(['Xscript0', 'Xscript1', 'Xscript2'], g:func_level) + call assert_equal(['Xscript2', 'Xscript1', 'Xscript0'], g:au_level) unlet g:script_level g:func_level delfunc F0 |