To: vim_dev@googlegroups.com Subject: Patch 8.2.2206 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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\\\"\", 'tx') + call assert_match('"' .. cmd .. ' SomeVar', @:) + call feedkeys(":" .. cmd .. " foo SomeV\\\"\", '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 -- Bram@Moolenaar.net -- 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 ///