Mercurial > vim
comparison src/eval.c @ 24533:9c404d78d767 v8.2.2806
patch 8.2.2806: Vim9: using "++nr" as a command might not work
Commit: https://github.com/vim/vim/commit/bdc0f1c6986e5d64f647e0924a4de795b47c549a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 24 19:08:24 2021 +0200
patch 8.2.2806: Vim9: using "++nr" as a command might not work
Problem: Vim9: using "++nr" as a command might not work.
Solution: Do not recognize "++" and "--" in a following line as addition or
subtraction.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 24 Apr 2021 19:15:04 +0200 |
parents | 887121a6d7cf |
children | cb0d344bd381 |
comparison
equal
deleted
inserted
replaced
24532:7660cdae6683 | 24533:9c404d78d767 |
---|---|
2854 typval_T var2; | 2854 typval_T var2; |
2855 int vim9script = in_vim9script(); | 2855 int vim9script = in_vim9script(); |
2856 | 2856 |
2857 // "." is only string concatenation when scriptversion is 1 | 2857 // "." is only string concatenation when scriptversion is 1 |
2858 // "+=", "-=" and "..=" are assignments | 2858 // "+=", "-=" and "..=" are assignments |
2859 // "++" and "--" on the next line are a separate command. | |
2859 p = eval_next_non_blank(*arg, evalarg, &getnext); | 2860 p = eval_next_non_blank(*arg, evalarg, &getnext); |
2860 op = *p; | 2861 op = *p; |
2861 concat = op == '.' && (*(p + 1) == '.' || current_sctx.sc_version < 2); | 2862 concat = op == '.' && (*(p + 1) == '.' || current_sctx.sc_version < 2); |
2862 if ((op != '+' && op != '-' && !concat) || p[1] == '=' | 2863 if ((op != '+' && op != '-' && !concat) || p[1] == '=' |
2863 || (p[1] == '.' && p[2] == '=')) | 2864 || (p[1] == '.' && p[2] == '=')) |
2865 break; | |
2866 if (getnext && (op == '+' || op == '-') && p[0] == p[1]) | |
2864 break; | 2867 break; |
2865 | 2868 |
2866 evaluate = evalarg == NULL ? 0 : (evalarg->eval_flags & EVAL_EVALUATE); | 2869 evaluate = evalarg == NULL ? 0 : (evalarg->eval_flags & EVAL_EVALUATE); |
2867 oplen = (concat && p[1] == '.') ? 2 : 1; | 2870 oplen = (concat && p[1] == '.') ? 2 : 1; |
2868 if (getnext) | 2871 if (getnext) |