aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-26 19:35:13 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-26 21:04:40 -0500
commit684172ae8299421a208a1e097c8ac4ec2118e01c (patch)
treee5ad2fb97e2e4ef73bb8ea8b5ef1375fac83f7c4 /src
parent0aa2c7e2ec2ee683a22fef68c229408708f7cd5d (diff)
downloadrneovim-684172ae8299421a208a1e097c8ac4ec2118e01c.tar.gz
rneovim-684172ae8299421a208a1e097c8ac4ec2118e01c.tar.bz2
rneovim-684172ae8299421a208a1e097c8ac4ec2118e01c.zip
vim-patch:8.2.1007: completion doesn't work after ":r ++arg !"
Problem: Completion doesn't work after ":r ++arg !". Solution: Skip over "++arg". (Christian Brabandt, closes vim/vim#6275, closes vim/vim#6258) https://github.com/vim/vim/commit/c8cb883015619cfe6db931ac2d6e15b0be5c56ed
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_docmd.c9
-rw-r--r--src/nvim/testdir/test_cmdline.vim14
2 files changed, 23 insertions, 0 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 601f4aab38..dea0d21ad2 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -3020,6 +3020,15 @@ const char * set_one_cmd_context(
arg = (const char *)skipwhite((const char_u *)arg);
}
+ // Skip over ++argopt argument
+ if ((ea.argt & ARGOPT) && *arg != NUL && strncmp(arg, "++", 2) == 0) {
+ p = arg;
+ while (*p && !ascii_isspace(*p)) {
+ MB_PTR_ADV(p);
+ }
+ arg = (const char *)skipwhite((const char_u *)p);
+ }
+
/*
* Check for '|' to separate commands and '"' to start comments.
* Don't do this for ":read !cmd" and ":write !cmd".
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim
index 5b23525ab5..09f02593a3 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/testdir/test_cmdline.vim
@@ -955,5 +955,19 @@ func Test_zero_line_search()
q!
endfunc
+func Test_read_shellcmd()
+ CheckUnix
+ if executable('ls')
+ " There should be ls in the $PATH
+ call feedkeys(":r! l\<c-a>\<c-b>\"\<cr>", 'tx')
+ call assert_match('^"r! .*\<ls\>', @:)
+ endif
+
+ if executable('rm')
+ call feedkeys(":r! ++enc=utf-8 r\<c-a>\<c-b>\"\<cr>", 'tx')
+ call assert_notmatch('^"r!.*\<runtest.vim\>', @:)
+ call assert_match('^"r!.*\<rm\>', @:)
+ endif
+endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab