Mercurial > vim
comparison src/scriptfile.c @ 23398:40f824f5c7c7 v8.2.2242
patch 8.2.2242: Vim9: bar line continuation does not work at script level
Commit: https://github.com/vim/vim/commit/8242ebbdba64cfa5c504c9d8dfb802076d99c602
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 29 11:15:01 2020 +0100
patch 8.2.2242: Vim9: bar line continuation does not work at script level
Problem: Vim9: line continuation with bar does not work at script level.
Solution: Check for Vim9 script.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 29 Dec 2020 11:15:34 +0100 |
parents | 517fca70e084 |
children | dc3b7a31c29f |
comparison
equal
deleted
inserted
replaced
23397:0a99720fc406 | 23398:40f824f5c7c7 |
---|---|
1739 struct source_cookie *sp = (struct source_cookie *)cookie; | 1739 struct source_cookie *sp = (struct source_cookie *)cookie; |
1740 char_u *line; | 1740 char_u *line; |
1741 char_u *p; | 1741 char_u *p; |
1742 int do_vim9_all = in_vim9script() | 1742 int do_vim9_all = in_vim9script() |
1743 && options == GETLINE_CONCAT_ALL; | 1743 && options == GETLINE_CONCAT_ALL; |
1744 int do_vim9_cont = do_vim9_all | 1744 int do_bar_cont = do_vim9_all |
1745 || options == GETLINE_CONCAT_CONTDEF; | 1745 || options == GETLINE_CONCAT_CONTBAR; |
1746 | 1746 |
1747 #ifdef FEAT_EVAL | 1747 #ifdef FEAT_EVAL |
1748 // If breakpoints have been added/deleted need to check for it. | 1748 // If breakpoints have been added/deleted need to check for it. |
1749 if (sp->dbg_tick < debug_tick) | 1749 if (sp->dbg_tick < debug_tick) |
1750 { | 1750 { |
1795 if (sp->nextline != NULL | 1795 if (sp->nextline != NULL |
1796 && (*(p = skipwhite(sp->nextline)) == '\\' | 1796 && (*(p = skipwhite(sp->nextline)) == '\\' |
1797 || (p[0] == '"' && p[1] == '\\' && p[2] == ' ') | 1797 || (p[0] == '"' && p[1] == '\\' && p[2] == ' ') |
1798 || (do_vim9_all && (*p == NUL | 1798 || (do_vim9_all && (*p == NUL |
1799 || vim9_comment_start(p))) | 1799 || vim9_comment_start(p))) |
1800 || (do_vim9_cont && p[0] == '|' && p[1] != '|'))) | 1800 || (do_bar_cont && p[0] == '|' && p[1] != '|'))) |
1801 { | 1801 { |
1802 garray_T ga; | 1802 garray_T ga; |
1803 | 1803 |
1804 ga_init2(&ga, (int)sizeof(char_u), 400); | 1804 ga_init2(&ga, (int)sizeof(char_u), 400); |
1805 ga_concat(&ga, line); | 1805 ga_concat(&ga, line); |
1815 vim_free(sp->nextline); | 1815 vim_free(sp->nextline); |
1816 sp->nextline = get_one_sourceline(sp); | 1816 sp->nextline = get_one_sourceline(sp); |
1817 if (sp->nextline == NULL) | 1817 if (sp->nextline == NULL) |
1818 break; | 1818 break; |
1819 p = skipwhite(sp->nextline); | 1819 p = skipwhite(sp->nextline); |
1820 if (*p == '\\' || (do_vim9_cont && p[0] == '|' && p[1] != '|')) | 1820 if (*p == '\\' || (do_bar_cont && p[0] == '|' && p[1] != '|')) |
1821 { | 1821 { |
1822 // Adjust the growsize to the current length to speed up | 1822 // Adjust the growsize to the current length to speed up |
1823 // concatenating many lines. | 1823 // concatenating many lines. |
1824 if (ga.ga_len > 400) | 1824 if (ga.ga_len > 400) |
1825 { | 1825 { |