aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pilling <robpilling@gmail.com>2019-03-08 22:49:48 +0000
committerRob Pilling <robpilling@gmail.com>2019-10-31 19:16:52 +0000
commit1c7aa1131297b4b3686d66aae06090e1398da56c (patch)
tree648f4bda3e8bc74be5ff3ebcf7bbbe781e8e5fa2
parent3b3d21775478cc97acf391a30d844eb3a81e96f6 (diff)
downloadrneovim-1c7aa1131297b4b3686d66aae06090e1398da56c.tar.gz
rneovim-1c7aa1131297b4b3686d66aae06090e1398da56c.tar.bz2
rneovim-1c7aa1131297b4b3686d66aae06090e1398da56c.zip
Allow multiple leading colons before and after modifiers for 'inccommand'
-rw-r--r--src/nvim/ex_docmd.c5
-rw-r--r--test/functional/ui/inccommand_spec.lua7
2 files changed, 11 insertions, 1 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 22c4fd264d..48d29caf60 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -10216,10 +10216,13 @@ bool cmd_can_preview(char_u *cmd)
return false;
}
+ // Ignore additional colons at the start...
+ cmd = skip_colon_white(cmd, true);
+
// Ignore any leading modifiers (:keeppatterns, :verbose, etc.)
for (int len = modifier_len(cmd); len != 0; len = modifier_len(cmd)) {
cmd += len;
- cmd = skipwhite(cmd);
+ cmd = skip_colon_white(cmd, true);
}
exarg_T ea;
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 82251a4b88..c5ad093eca 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -779,6 +779,13 @@ describe(":substitute, inccommand=split", function()
{15:~ }|
:silent tabedit %s/tw/to^ |
]])
+ feed('<Esc>')
+
+ -- leading colons
+ feed(':::%s/tw/to')
+ screen:expect{any=[[{12:to}o lines]]}
+ feed('<Esc>')
+ screen:expect{any=[[two lines]]}
end)
it('shows split window when typing the pattern', function()