1
0
forked from aniani/vim

patch 8.2.3482: reading beyond end of line ending in quote and backslash

Problem:    Reading beyond end of line ending in quote and backslash.
Solution:   Check for non-NUL after backslash. (closes #8964)
This commit is contained in:
Bram Moolenaar
2021-10-05 21:58:53 +01:00
parent 2e258bd79f
commit 78e0fa4cf4
3 changed files with 11 additions and 2 deletions

View File

@@ -82,10 +82,10 @@ skip_string(char_u *p)
{ {
if (p[0] == '\'') // 'c' or '\n' or '\000' if (p[0] == '\'') // 'c' or '\n' or '\000'
{ {
if (!p[1]) // ' at end of line if (p[1] == NUL) // ' at end of line
break; break;
i = 2; i = 2;
if (p[1] == '\\') // '\n' or '\000' if (p[1] == '\\' && p[2] != NUL) // '\n' or '\000'
{ {
++i; ++i;
while (vim_isdigit(p[i - 1])) // '\000' while (vim_isdigit(p[i - 1])) // '\000'

View File

@@ -5307,4 +5307,11 @@ func Test_cindent_pragma()
enew! | close enew! | close
endfunc endfunc
func Test_backslash_at_end_of_line()
new
exe "norm v>O'\\\<C-m>-"
exe "norm \<C-q>="
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -757,6 +757,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3482,
/**/ /**/
3481, 3481,
/**/ /**/