diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-02-07 17:17:58 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-02-07 17:17:58 +0100 |
commit | 0123cc1e1422003704cc6941916dd75e61fb7976 (patch) | |
tree | 2566043accaead2dabf88969d18611289c740522 | |
parent | dee37dc733df444df1950eb922a35560e4b113d6 (diff) | |
download | vim-git-0123cc1e1422003704cc6941916dd75e61fb7976.tar.gz |
patch 8.2.2485: when sourcing a script again the script version isn't resetv8.2.2485
Problem: When sourcing a script again the script version isn't reset.
Solution: Set sn_version to one when sourcing a script again. Clear
sn_save_cpo properly. (closes #7608)
-rw-r--r-- | src/scriptfile.c | 5 | ||||
-rw-r--r-- | src/testdir/test_vim9_script.vim | 15 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 20 insertions, 2 deletions
diff --git a/src/scriptfile.c b/src/scriptfile.c index c8a23d55a..82ae42a1a 100644 --- a/src/scriptfile.c +++ b/src/scriptfile.c @@ -1319,6 +1319,9 @@ do_source( } // imports can be redefined once mark_imports_for_reload(sid); + + // reset version, "vim9script" may have been added or removed. + si->sn_version = 1; } else { @@ -1457,7 +1460,7 @@ almosttheend: if (si->sn_save_cpo != NULL) { set_option_value((char_u *)"cpo", 0L, si->sn_save_cpo, 0); - CLEAR_POINTER(si->sn_save_cpo); + VIM_CLEAR(si->sn_save_cpo); } restore_funccal(); diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index 7f1e71dc6..42a0d61dd 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -2207,7 +2207,7 @@ def Test_while_loop() assert_equal('1_3_', result) var s = '' - while s == 'x' #{comment + while s == 'x' #{comment} endwhile enddef @@ -3155,6 +3155,19 @@ def Test_restoring_cpo() delete('Xsourced') delete('Xclose') delete('Xdone') + + writefile(['vim9script'], 'XanotherScript') + set cpo=aABceFsMny> + edit XanotherScript + so % + assert_equal('aABceFsMny>', &cpo) + :1del + w + so % + assert_equal('aABceFsMny>', &cpo) + + delete('XanotherScript') + set cpo&vim enddef diff --git a/src/version.c b/src/version.c index cbef3daf6..ca79c64dd 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2485, +/**/ 2484, /**/ 2483, |