Mercurial > vim
changeset 24774:8bf9726097d8 v8.2.2925
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Commit: https://github.com/vim/vim/commit/0f37e3561db95b0ef0b636588bbd30297e377384
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jun 2 15:28:15 2021 +0200
patch 8.2.2925: Vim9: line continuation comment uses legacy syntax
Problem: Vim9: line continuation comment uses legacy syntax.
Solution: Check for #\ instead of "\. (closes https://github.com/vim/vim/issues/8295)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 02 Jun 2021 15:30:02 +0200 |
parents | 44f5815a3925 |
children | f3e925a22651 |
files | src/scriptfile.c src/testdir/test_vim9_script.vim src/version.c |
diffstat | 3 files changed, 22 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/scriptfile.c +++ b/src/scriptfile.c @@ -1842,7 +1842,8 @@ getsourceline( ga_concat(&ga, p); } } - else if (!(p[0] == '"' && p[1] == '\\' && p[2] == ' ') + else if (!(p[0] == (in_vim9script() ? '#' : '"') + && p[1] == '\\' && p[2] == ' ') && !(do_vim9_all && (*p == NUL || vim9_comment_start(p)))) break; /* drop a # comment or "\ comment line */
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -3074,6 +3074,24 @@ def Test_vim9_comment() 'func Test() # comment', 'endfunc', ], 'E488:') + + var lines =<< trim END + vim9script + syn region Text + \ start='foo' + #\ comment + \ end='bar' + END + CheckScriptSuccess(lines) + + lines =<< trim END + vim9script + syn region Text + \ start='foo' + "\ comment + \ end='bar' + END + CheckScriptFailure(lines, 'E399:') enddef def Test_vim9_comment_gui()