mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
Merge pull request #20364 from zeertzjq/parse-cmd-omit
fix(api)!: nvim_parse_cmd omit "count" "range" "reg" if not supported
This commit is contained in:
@@ -3178,9 +3178,6 @@ describe('API', function()
|
||||
cmd = 'echo',
|
||||
args = { 'foo' },
|
||||
bang = false,
|
||||
range = {},
|
||||
count = -1,
|
||||
reg = '',
|
||||
addr = 'none',
|
||||
magic = {
|
||||
file = false,
|
||||
@@ -3221,8 +3218,6 @@ describe('API', function()
|
||||
args = { '/math.random/math.max/' },
|
||||
bang = false,
|
||||
range = { 4, 6 },
|
||||
count = -1,
|
||||
reg = '',
|
||||
addr = 'line',
|
||||
magic = {
|
||||
file = false,
|
||||
@@ -3264,7 +3259,6 @@ describe('API', function()
|
||||
bang = false,
|
||||
range = { 1 },
|
||||
count = 1,
|
||||
reg = '',
|
||||
addr = 'buf',
|
||||
magic = {
|
||||
file = false,
|
||||
@@ -3305,7 +3299,6 @@ describe('API', function()
|
||||
args = {},
|
||||
bang = false,
|
||||
range = {},
|
||||
count = -1,
|
||||
reg = '+',
|
||||
addr = 'line',
|
||||
magic = {
|
||||
@@ -3340,6 +3333,45 @@ describe('API', function()
|
||||
vertical = false,
|
||||
}
|
||||
}, meths.parse_cmd('put +', {}))
|
||||
eq({
|
||||
cmd = 'put',
|
||||
args = {},
|
||||
bang = false,
|
||||
range = {},
|
||||
reg = '',
|
||||
addr = 'line',
|
||||
magic = {
|
||||
file = false,
|
||||
bar = true
|
||||
},
|
||||
nargs = '0',
|
||||
nextcmd = '',
|
||||
mods = {
|
||||
browse = false,
|
||||
confirm = false,
|
||||
emsg_silent = false,
|
||||
filter = {
|
||||
pattern = "",
|
||||
force = false
|
||||
},
|
||||
hide = false,
|
||||
horizontal = false,
|
||||
keepalt = false,
|
||||
keepjumps = false,
|
||||
keepmarks = false,
|
||||
keeppatterns = false,
|
||||
lockmarks = false,
|
||||
noautocmd = false,
|
||||
noswapfile = false,
|
||||
sandbox = false,
|
||||
silent = false,
|
||||
split = "",
|
||||
tab = -1,
|
||||
unsilent = false,
|
||||
verbose = -1,
|
||||
vertical = false,
|
||||
}
|
||||
}, meths.parse_cmd('put', {}))
|
||||
end)
|
||||
it('works with range, count and register', function()
|
||||
eq({
|
||||
@@ -3389,8 +3421,6 @@ describe('API', function()
|
||||
args = {},
|
||||
bang = true,
|
||||
range = {},
|
||||
count = -1,
|
||||
reg = '',
|
||||
addr = 'line',
|
||||
magic = {
|
||||
file = true,
|
||||
@@ -3431,8 +3461,6 @@ describe('API', function()
|
||||
args = { 'foo.txt' },
|
||||
bang = false,
|
||||
range = {},
|
||||
count = -1,
|
||||
reg = '',
|
||||
addr = '?',
|
||||
magic = {
|
||||
file = true,
|
||||
@@ -3471,8 +3499,6 @@ describe('API', function()
|
||||
args = { 'foo.txt' },
|
||||
bang = false,
|
||||
range = {},
|
||||
count = -1,
|
||||
reg = '',
|
||||
addr = '?',
|
||||
magic = {
|
||||
file = true,
|
||||
@@ -3514,8 +3540,6 @@ describe('API', function()
|
||||
args = { 'test', 'it' },
|
||||
bang = true,
|
||||
range = { 4, 6 },
|
||||
count = -1,
|
||||
reg = '',
|
||||
addr = 'line',
|
||||
magic = {
|
||||
file = false,
|
||||
@@ -3556,8 +3580,6 @@ describe('API', function()
|
||||
args = { 'a.txt' },
|
||||
bang = false,
|
||||
range = {},
|
||||
count = -1,
|
||||
reg = '',
|
||||
addr = 'arg',
|
||||
magic = {
|
||||
file = true,
|
||||
@@ -3598,9 +3620,6 @@ describe('API', function()
|
||||
cmd = 'MyCommand',
|
||||
args = { 'test it' },
|
||||
bang = false,
|
||||
range = {},
|
||||
count = -1,
|
||||
reg = '',
|
||||
addr = 'none',
|
||||
magic = {
|
||||
file = false,
|
||||
@@ -3692,8 +3711,6 @@ describe('API', function()
|
||||
args = {'x'},
|
||||
bang = true,
|
||||
range = {3, 4},
|
||||
count = -1,
|
||||
reg = '',
|
||||
addr = 'line',
|
||||
magic = {
|
||||
file = false,
|
||||
@@ -3731,6 +3748,11 @@ describe('API', function()
|
||||
eq('', funcs.getreg('/'))
|
||||
eq('', funcs.histget('search'))
|
||||
end)
|
||||
it('result can be used directly by nvim_cmd #20051', function()
|
||||
eq("foo", meths.cmd(meths.parse_cmd('echo "foo"', {}), { output = true }))
|
||||
meths.cmd(meths.parse_cmd("set cursorline", {}), {})
|
||||
eq(true, meths.get_option_value("cursorline", {}))
|
||||
end)
|
||||
end)
|
||||
describe('nvim_cmd', function()
|
||||
it('works', function ()
|
||||
|
||||
Reference in New Issue
Block a user