Mercurial > vim
comparison src/vim9compile.c @ 22606:336ac63fb987 v8.2.1851
patch 8.2.1851: Vim9: "!" followed by space incorrectly used
Commit: https://github.com/vim/vim/commit/27491cd3ef86c10a2b64bcb657f29e1d0fccb183
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 15 21:54:56 2020 +0200
patch 8.2.1851: Vim9: "!" followed by space incorrectly used
Problem: Vim9: "!" followed by space incorrectly used.
Solution: Skip over trailing spaces. (closes https://github.com/vim/vim/issues/7131)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 15 Oct 2020 22:00:04 +0200 |
parents | c7ef64b85e9b |
children | 048a3033d19c |
comparison
equal
deleted
inserted
replaced
22605:79ac2ddec7e0 | 22606:336ac63fb987 |
---|---|
3039 else if (numeric_only) | 3039 else if (numeric_only) |
3040 { | 3040 { |
3041 ++p; | 3041 ++p; |
3042 break; | 3042 break; |
3043 } | 3043 } |
3044 else | 3044 else if (*p == '!') |
3045 { | 3045 { |
3046 int v = tv2bool(rettv); | 3046 int v = tv2bool(rettv); |
3047 | 3047 |
3048 // '!' is permissive in the type. | 3048 // '!' is permissive in the type. |
3049 clear_tv(rettv); | 3049 clear_tv(rettv); |
3176 ++p; | 3176 ++p; |
3177 break; | 3177 break; |
3178 } | 3178 } |
3179 else | 3179 else |
3180 { | 3180 { |
3181 int invert = TRUE; | 3181 int invert = *p == '!'; |
3182 | 3182 |
3183 while (p > start && p[-1] == '!') | 3183 while (p > start && (p[-1] == '!' || VIM_ISWHITE(p[-1]))) |
3184 { | 3184 { |
3185 if (p[-1] == '!') | |
3186 invert = !invert; | |
3185 --p; | 3187 --p; |
3186 invert = !invert; | |
3187 } | 3188 } |
3188 if (generate_2BOOL(cctx, invert) == FAIL) | 3189 if (generate_2BOOL(cctx, invert) == FAIL) |
3189 return FAIL; | 3190 return FAIL; |
3190 } | 3191 } |
3191 } | 3192 } |