Content-Length: 280754 | pFad | https://github.com/vim/vim/commit/28c56d501352bd98472d23667bade683877cadcc

2E patch 9.0.0869: bogus error when string used after :elseif · vim/vim@28c56d5 · GitHub
Skip to content

Commit

Permalink
patch 9.0.0869: bogus error when string used after :elseif
Browse files Browse the repository at this point in the history
Problem:    Bogus error when string used after :elseif.
Solution:   Do not consider a double quote the start of a comment.
            (closes #11534)
  • Loading branch information
brammool committed Nov 12, 2022
1 parent 1140b51 commit 28c56d5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ex_eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,8 @@ ex_else(exarg_T *eap)
{
// When skipping we ignore most errors, but a missing expression is
// wrong, perhaps it should have been "else".
if (skip && ends_excmd(*eap->arg))
// A double quote here is the start of a string, not a comment.
if (skip && *eap->arg != '"' && ends_excmd(*eap->arg))
semsg(_(e_invalid_expression_str), eap->arg);
else
result = eval_to_bool(eap->arg, &error, eap, skip, FALSE);
Expand Down
10 changes: 10 additions & 0 deletions src/testdir/test_vimscript.vim
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ func Test_if_while()
call assert_equal('ab3j3b2c2b1f1h1km', g:Xpath)
endfunc

" Check double quote after skipped "elseif" does not give error E15
func Test_skipped_elseif()
if "foo" ==? "foo"
let result = "first"
elseif "foo" ==? "foo"
let result = "second"
endif
call assert_equal('first', result)
endfunc

"-------------------------------------------------------------------------------
" Test 4: :return {{{1
"-------------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
869,
/**/
868,
/**/
Expand Down

0 comments on commit 28c56d5

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/vim/vim/commit/28c56d501352bd98472d23667bade683877cadcc

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy