aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
diff options
context:
space:
mode:
authorFamiu Haque <famiuhaque@protonmail.com>2022-05-07 08:57:21 +0600
committerFamiu Haque <famiuhaque@protonmail.com>2022-05-07 12:26:49 +0600
commit14f3383c0da1413a5ae82feb19ac89f01d4b9aad (patch)
tree5ebc5fa82a29f0dd3e3aafc927b517a0d95e7ae9 /test/functional/api/vim_spec.lua
parentb2a8ed08551d2edf2bf98e830860f0130acd00f8 (diff)
downloadrneovim-14f3383c0da1413a5ae82feb19ac89f01d4b9aad.tar.gz
rneovim-14f3383c0da1413a5ae82feb19ac89f01d4b9aad.tar.bz2
rneovim-14f3383c0da1413a5ae82feb19ac89f01d4b9aad.zip
fix(api): make `nvim_parse_cmd` work correctly with both range and count
It seems range and count can be used together in commands. This PR fixes the behavior of `nvim_parse_cmd` for those cases by removing the mutual exclusivity of "range" and "count". It also removes range line number validation for `nvim_parse_cmd` as it's not its job to validate the command.
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r--test/functional/api/vim_spec.lua38
1 files changed, 37 insertions, 1 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 11c1fc6c2c..d68f299277 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -3176,7 +3176,7 @@ describe('API', function()
cmd = 'buffer',
args = {},
bang = false,
- range = {},
+ range = { 1 },
count = 1,
reg = '',
addr = 'buf',
@@ -3243,6 +3243,42 @@ describe('API', function()
}
}, meths.parse_cmd('put +', {}))
end)
+ it('works with range, count and register', function()
+ eq({
+ cmd = 'delete',
+ args = {},
+ bang = false,
+ range = { 3, 7 },
+ count = 7,
+ reg = '*',
+ addr = 'line',
+ magic = {
+ file = false,
+ bar = true
+ },
+ nargs = '0',
+ nextcmd = '',
+ mods = {
+ browse = false,
+ confirm = false,
+ emsg_silent = false,
+ hide = false,
+ keepalt = false,
+ keepjumps = false,
+ keepmarks = false,
+ keeppatterns = false,
+ lockmarks = false,
+ noautocmd = false,
+ noswapfile = false,
+ sandbox = false,
+ silent = false,
+ vertical = false,
+ split = "",
+ tab = 0,
+ verbose = -1
+ }
+ }, meths.parse_cmd('1,3delete * 5', {}))
+ end)
it('works with bang', function()
eq({
cmd = 'write',