]> granicus.if.org Git - vim/commitdiff
patch 8.2.2931: Vim9: line continuation comment uses legacy syntax v8.2.2931
authorBram Moolenaar <Bram@vim.org>
Thu, 3 Jun 2021 19:56:10 +0000 (21:56 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 3 Jun 2021 19:56:10 +0000 (21:56 +0200)
Problem:    Vim9: line continuation comment still uses legacy syntax in one
            place.
Solution:   Check for #\ instead of "\ earlier. (closes #8316)

src/scriptfile.c
src/testdir/test_vim9_script.vim
src/version.c

index 15338be63269e2e0b083f2aedb3061661dfe5a7f..bbc415664e0e2cd9ef486a9af0e015856daa4f97 100644 (file)
@@ -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;
index ee324950fed58fd34ba6ba5a0a98427880dc2bea..d5951c647a15e6262b6e21c6d229ae521511d858 100644 (file)
@@ -3081,6 +3081,9 @@ def Test_vim9_comment()
       \ start='foo'
       #\ comment
       \ end='bar'
+      syn region Text start='foo'
+      #\ comment
+      \ end='bar'
   END
   CheckScriptSuccess(lines)
 
index f89a1490f1d1f5c6a67531562ff4d7284ca775f4..57a4dcd263ab634b28fd0d53a8b6b1f8c0931c81 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2931,
 /**/
     2930,
 /**/