changeset 24786:524120691c3d v8.2.2931

patch 8.2.2931: Vim9: line continuation comment uses legacy syntax Commit: https://github.com/vim/vim/commit/5072b47a223fb044041b8e7db59a17b3b1d8a625 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 3 21:56:10 2021 +0200 patch 8.2.2931: Vim9: line continuation comment uses legacy syntax Problem: Vim9: line continuation comment still uses legacy syntax in one place. Solution: Check for #\ instead of "\ earlier. (closes #8316)
author Bram Moolenaar <Bram@vim.org>
date Thu, 03 Jun 2021 22:00:04 +0200
parents cbbb6681c0ba
children 7ac638bad396
files src/scriptfile.c src/testdir/test_vim9_script.vim src/version.c
diffstat 3 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -1788,6 +1788,8 @@ getsourceline(
     if (line != NULL && options != GETLINE_NONE
 				      && vim_strchr(p_cpo, CPO_CONCAT) == NULL)
     {
+	int comment_char = in_vim9script() ? '#' : '"';
+
 	// compensate for the one line read-ahead
 	--sp->sourcing_lnum;
 
@@ -1800,7 +1802,8 @@ getsourceline(
 	sp->nextline = get_one_sourceline(sp);
 	if (sp->nextline != NULL
 		&& (*(p = skipwhite(sp->nextline)) == '\\'
-			      || (p[0] == '"' && p[1] == '\\' && p[2] == ' ')
+			      || (p[0] == comment_char
+						&& p[1] == '\\' && p[2] == ' ')
 			      || (do_vim9_all && (*p == NUL
 						     || vim9_comment_start(p)))
 			      || (do_bar_cont && p[0] == '|' && p[1] != '|')))
@@ -1842,7 +1845,7 @@ getsourceline(
 			ga_concat(&ga, p);
 		    }
 		}
-		else if (!(p[0] == (in_vim9script() ? '#' : '"')
+		else if (!(p[0] == (comment_char)
 						&& p[1] == '\\' && p[2] == ' ')
 		     && !(do_vim9_all && (*p == NUL || vim9_comment_start(p))))
 		    break;
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -3081,6 +3081,9 @@ def Test_vim9_comment()
       \ start='foo'
       #\ comment
       \ end='bar'
+      syn region Text start='foo'
+      #\ comment
+      \ end='bar'
   END
   CheckScriptSuccess(lines)
 
--- 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 */
 /**/
+    2931,
+/**/
     2930,
 /**/
     2929,