aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-25 17:57:32 +0800
committerGitHub <noreply@github.com>2022-08-25 17:57:32 +0800
commit274e1122ade42095cd5b6416e70bda3aa0cb0423 (patch)
tree5a3f1320f621eeaff2c6bbd2513ec2b5852d6974
parentf0658fd552ec2d72cdd3f09942fe104bc6265115 (diff)
downloadrneovim-274e1122ade42095cd5b6416e70bda3aa0cb0423.tar.gz
rneovim-274e1122ade42095cd5b6416e70bda3aa0cb0423.tar.bz2
rneovim-274e1122ade42095cd5b6416e70bda3aa0cb0423.zip
fix(usercmd): also check for whitespace after escaped character (#19942)
-rw-r--r--src/nvim/usercmd.c10
-rw-r--r--test/functional/api/command_spec.lua6
2 files changed, 8 insertions, 8 deletions
diff --git a/src/nvim/usercmd.c b/src/nvim/usercmd.c
index 59b8d10200..e130db69f2 100644
--- a/src/nvim/usercmd.c
+++ b/src/nvim/usercmd.c
@@ -1061,11 +1061,11 @@ bool uc_split_args_iter(const char *arg, size_t arglen, size_t *end, char *buf,
buf[l++] = arg[++pos];
} else {
buf[l++] = arg[pos];
- if (ascii_iswhite(arg[pos + 1])) {
- *end = pos + 1;
- *len = l;
- return false;
- }
+ }
+ if (ascii_iswhite(arg[pos + 1])) {
+ *end = pos + 1;
+ *len = l;
+ return false;
}
}
diff --git a/test/functional/api/command_spec.lua b/test/functional/api/command_spec.lua
index 890710b6e6..440e93da0e 100644
--- a/test/functional/api/command_spec.lua
+++ b/test/functional/api/command_spec.lua
@@ -114,8 +114,8 @@ describe('nvim_create_user_command', function()
]]
eq({
- args = [[this is a\ test]],
- fargs = {"this", "is", "a test"},
+ args = [[this\ is a\ test]],
+ fargs = {"this ", "is", "a test"},
bang = false,
line1 = 1,
line2 = 1,
@@ -144,7 +144,7 @@ describe('nvim_create_user_command', function()
count = 2,
reg = "",
}, exec_lua [=[
- vim.api.nvim_command([[CommandWithLuaCallback this is a\ test]])
+ vim.api.nvim_command([[CommandWithLuaCallback this\ is a\ test]])
return result
]=])