Patch 8.2.2206
Problem: :exe command line completion only works for first argument.
Solution: Skip over text if more is following. (closes #7546)
Files: src/eval.c, src/testdir/test_cmdline.vim
*** ../vim-8.2.2205/src/eval.c 2020-12-22 22:07:25.556665849 +0100
--- src/eval.c 2020-12-24 17:02:37.247962574 +0100
***************
*** 1904,1909 ****
--- 1904,1927 ----
while ((c = *++arg) != NUL && (c == ' ' || c == '\t'))
/* skip */ ;
}
+
+ // ":exe one two" completes "two"
+ if ((cmdidx == CMD_execute
+ || cmdidx == CMD_echo
+ || cmdidx == CMD_echon
+ || cmdidx == CMD_echomsg)
+ && xp->xp_context == EXPAND_EXPRESSION)
+ {
+ for (;;)
+ {
+ char_u *n = skiptowhite(arg);
+
+ if (n == arg || IS_WHITE_OR_NUL(*skipwhite(n)))
+ break;
+ arg = skipwhite(n);
+ }
+ }
+
xp->xp_pattern = arg;
}
*** ../vim-8.2.2205/src/testdir/test_cmdline.vim 2020-11-21
21:41:36.182011155 +0100
--- src/testdir/test_cmdline.vim 2020-12-24 17:12:18.221917492 +0100
***************
*** 673,678 ****
--- 673,689 ----
unlet $X_VIM_TEST_COMPLETE_ENV
endfunc
+ func Test_cmdline_complete_expression()
+ let g:SomeVar = 'blah'
+ for cmd in ['exe', 'echo', 'echon', 'echomsg']
+ call feedkeys(":" .. cmd .. " SomeV\<Tab>\<C-B>\"\<CR>", 'tx')
+ call assert_match('"' .. cmd .. ' SomeVar', @:)
+ call feedkeys(":" .. cmd .. " foo SomeV\<Tab>\<C-B>\"\<CR>", 'tx')
+ call assert_match('"' .. cmd .. ' foo SomeVar', @:)
+ endfor
+ unlet g:SomeVar
+ endfunc
+
" Test for various command-line completion
func Test_cmdline_complete_various()
" completion for a command starting with a comment
*** ../vim-8.2.2205/src/version.c 2020-12-24 16:05:54.339860228 +0100
--- src/version.c 2020-12-24 17:04:14.487623935 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2206,
/**/
--
Anyone who is capable of getting themselves made President should on no
account be allowed to do the job.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202012241616.0BOGGS0R3240057%40masaka.moolenaar.net.