aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro@gmail.com>2022-05-12 16:43:20 +0200
committerGitHub <noreply@github.com>2022-05-12 16:43:20 +0200
commit8fba428bc6f36ae038a9286517e15b33257a1359 (patch)
tree3d0297f740c695389c65a2ab867ec03eb749ff08 /test/functional
parent78a1e6bc0060eec1afa7de099c4cee35ca35527f (diff)
downloadrneovim-8fba428bc6f36ae038a9286517e15b33257a1359.tar.gz
rneovim-8fba428bc6f36ae038a9286517e15b33257a1359.tar.bz2
rneovim-8fba428bc6f36ae038a9286517e15b33257a1359.zip
fix(cmd): make :-tabmove work with modifiers (#18447)
`:tabmove` takes either an argument (`:tabmove -`) or an address (`:-tabmove`). The code assumed that `:tabmove` is the first command on the cmdline, but that is not the case when using additional modifiers like `:silent`. Make the addr parsing more robust by searching the command first, then going back to check for a potential address `-`.
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/editor/tabpage_spec.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/functional/editor/tabpage_spec.lua b/test/functional/editor/tabpage_spec.lua
index 2494daf99b..3b2c1db350 100644
--- a/test/functional/editor/tabpage_spec.lua
+++ b/test/functional/editor/tabpage_spec.lua
@@ -7,6 +7,7 @@ local neq = helpers.neq
local feed = helpers.feed
local eval = helpers.eval
local exec = helpers.exec
+local funcs = helpers.funcs
describe('tabpage', function()
before_each(clear)
@@ -51,5 +52,13 @@ describe('tabpage', function()
]])
neq(999, eval('g:win_closed'))
end)
-end)
+ it(":tabmove handles modifiers and addr", function()
+ command('tabnew | tabnew | tabnew')
+ eq(4, funcs.nvim_tabpage_get_number(0))
+ command(' silent :keepalt :: ::: silent! - tabmove')
+ eq(3, funcs.nvim_tabpage_get_number(0))
+ command(' silent :keepalt :: ::: silent! -2 tabmove')
+ eq(1, funcs.nvim_tabpage_get_number(0))
+ end)
+end)