diff options
author | erw7 <erw7.github@gmail.com> | 2019-05-29 12:06:39 +0900 |
---|---|---|
committer | erw7 <erw7.github@gmail.com> | 2019-05-29 12:54:42 +0900 |
commit | bfc44a91acdfb968cb3d0d21effc4ea9cbcd09e1 (patch) | |
tree | db93be271b130d3e328373ee9b895d2b711ea8ff /src/nvim/eval.c | |
parent | d46aaa074640ef92382e5800297b7c76ed7574da (diff) | |
download | rneovim-bfc44a91acdfb968cb3d0d21effc4ea9cbcd09e1.tar.gz rneovim-bfc44a91acdfb968cb3d0d21effc4ea9cbcd09e1.tar.bz2 rneovim-bfc44a91acdfb968cb3d0d21effc4ea9cbcd09e1.zip |
vim-patch:8.1.1114: confusing overloaded operator "." for string concatenation
Problem: Confusing overloaded operator "." for string concatenation.
Solution: Add ".." for string concatenation. Also "let a ..= b".
https://github.com/vim/vim/commit/0f248b006c2574abc00c9aa7886d8f33620eb822
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 7d7c2d3f33..1640729c94 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -1446,6 +1446,7 @@ int eval_foldexpr(char_u *arg, int *cp) * ":let var /= expr" assignment command. * ":let var %= expr" assignment command. * ":let var .= expr" assignment command. + * ":let var ..= expr" assignment command. * ":let [var1, var2] = expr" unpack list. */ void ex_let(exarg_T *eap) @@ -1468,8 +1469,8 @@ void ex_let(exarg_T *eap) argend--; } expr = skipwhite(argend); - if (*expr != '=' && !(vim_strchr((char_u *)"+-*/%.", *expr) != NULL - && expr[1] == '=')) { + if (*expr != '=' && !((vim_strchr((char_u *)"+-*/%.", *expr) != NULL + && expr[1] == '=') || STRNCMP(expr, "..=", 3) == 0)) { // ":let" without "=": list variables if (*arg == '[') { EMSG(_(e_invarg)); @@ -1493,6 +1494,9 @@ void ex_let(exarg_T *eap) if (*expr != '=') { if (vim_strchr((char_u *)"+-*/%.", *expr) != NULL) { op[0] = *expr; // +=, -=, *=, /=, %= or .= + if (expr[0] == '.' && expr[1] == '.') { // ..= + expr++; + } } expr = skipwhite(expr + 2); } else { @@ -3789,6 +3793,7 @@ static int eval4(char_u **arg, typval_T *rettv, int evaluate) * + number addition * - number subtraction * . string concatenation + * .. string concatenation * * "arg" must point to the first non-white of the expression. * "arg" is advanced to the next non-white after the recognized expression. @@ -3836,6 +3841,9 @@ static int eval5(char_u **arg, typval_T *rettv, int evaluate) /* * Get the second variable. */ + if (op == '.' && *(*arg + 1) == '.') { // ..string concatenation + (*arg)++; + } *arg = skipwhite(*arg + 1); if (eval6(arg, &var2, evaluate, op == '.') == FAIL) { tv_clear(rettv); |