mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.229
Problem: Using ":let" for listing variables and the second one is a curly braces expression may fail. Solution: Check for an "=" in a better way. (ZyX) https://code.google.com/p/vim/source/detail?r=839cca5ec18d560e3714065e54ed38b6e812aaf7
This commit is contained in:
parent
a129ab20e7
commit
d322be894e
20
src/eval.c
20
src/eval.c
@ -1751,11 +1751,10 @@ void ex_let(exarg_T *eap)
|
|||||||
return;
|
return;
|
||||||
if (argend > arg && argend[-1] == '.') /* for var.='str' */
|
if (argend > arg && argend[-1] == '.') /* for var.='str' */
|
||||||
--argend;
|
--argend;
|
||||||
expr = vim_strchr(argend, '=');
|
expr = skipwhite(argend);
|
||||||
if (expr == NULL) {
|
if (*expr != '=' && !(vim_strchr((char_u *)"+-.", *expr) != NULL
|
||||||
/*
|
&& expr[1] == '=')) {
|
||||||
* ":let" without "=": list variables
|
// ":let" without "=": list variables
|
||||||
*/
|
|
||||||
if (*arg == '[')
|
if (*arg == '[')
|
||||||
EMSG(_(e_invarg));
|
EMSG(_(e_invarg));
|
||||||
else if (!ends_excmd(*arg))
|
else if (!ends_excmd(*arg))
|
||||||
@ -1775,11 +1774,14 @@ void ex_let(exarg_T *eap)
|
|||||||
} else {
|
} else {
|
||||||
op[0] = '=';
|
op[0] = '=';
|
||||||
op[1] = NUL;
|
op[1] = NUL;
|
||||||
if (expr > argend) {
|
if (*expr != '=') {
|
||||||
if (vim_strchr((char_u *)"+-.", expr[-1]) != NULL)
|
if (vim_strchr((char_u *)"+-.", *expr) != NULL) {
|
||||||
op[0] = expr[-1]; /* +=, -= or .= */
|
op[0] = *expr; // +=, -=, .=
|
||||||
|
}
|
||||||
|
expr = skipwhite(expr + 2);
|
||||||
|
} else {
|
||||||
|
expr = skipwhite(expr + 1);
|
||||||
}
|
}
|
||||||
expr = skipwhite(expr + 1);
|
|
||||||
|
|
||||||
if (eap->skip)
|
if (eap->skip)
|
||||||
++emsg_skip;
|
++emsg_skip;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Tests for autoload. vim: set ft=vim ts=8 :
|
Tests for :let. vim: set ft=vim ts=8 :
|
||||||
|
|
||||||
STARTTEST
|
STARTTEST
|
||||||
:so small.vim
|
:so small.vim
|
||||||
@ -10,6 +10,20 @@ STARTTEST
|
|||||||
:catch
|
:catch
|
||||||
: $put ='FAIL: ' . v:exception
|
: $put ='FAIL: ' . v:exception
|
||||||
:endtry
|
:endtry
|
||||||
|
:let a = 1
|
||||||
|
:let b = 2
|
||||||
|
:for letargs in ['a b', '{0 == 1 ? "a" : "b"}', '{0 == 1 ? "a" : "b"} a', 'a {0 == 1 ? "a" : "b"}']
|
||||||
|
: try
|
||||||
|
: redir => messages
|
||||||
|
: execute 'let' letargs
|
||||||
|
: redir END
|
||||||
|
: $put ='OK:'
|
||||||
|
: $put =split(substitute(messages, '\n', '\0 ', 'g'), '\n')
|
||||||
|
: catch
|
||||||
|
: $put ='FAIL: ' . v:exception
|
||||||
|
: redir END
|
||||||
|
: endtry
|
||||||
|
:endfor
|
||||||
:/^Results/,$wq! test.out
|
:/^Results/,$wq! test.out
|
||||||
ENDTEST
|
ENDTEST
|
||||||
|
|
||||||
|
@ -1,2 +1,13 @@
|
|||||||
Results of test104:
|
Results of test104:
|
||||||
OK: function('tr')
|
OK: function('tr')
|
||||||
|
OK:
|
||||||
|
a #1
|
||||||
|
b #2
|
||||||
|
OK:
|
||||||
|
b #2
|
||||||
|
OK:
|
||||||
|
b #2
|
||||||
|
a #1
|
||||||
|
OK:
|
||||||
|
a #1
|
||||||
|
b #2
|
||||||
|
@ -232,7 +232,7 @@ static int included_patches[] = {
|
|||||||
//232,
|
//232,
|
||||||
//231,
|
//231,
|
||||||
//230,
|
//230,
|
||||||
//229,
|
229,
|
||||||
//228,
|
//228,
|
||||||
//227,
|
//227,
|
||||||
//226,
|
//226,
|
||||||
|
Loading…
Reference in New Issue
Block a user