summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-03-02 23:05:51 +0100
committerBram Moolenaar <Bram@vim.org>2017-03-02 23:05:51 +0100
commitcf5fdf7d1689ecb145b634dcb9c6e9fc60f63869 (patch)
treea5b52e8489182880d05a45ae2bd9dd7607b4f6c5 /src
parenta0107bdf8762d81cb49909ef02ffff9954092fb6 (diff)
downloadvim-git-cf5fdf7d1689ecb145b634dcb9c6e9fc60f63869.tar.gz
patch 8.0.0402: :map completion does not have <special>v8.0.0402
Problem: :map completion does not have <special>. (Dominique Pelle) Solution: Recognize <special> in completion. Add a test.
Diffstat (limited to 'src')
-rw-r--r--src/getchar.c9
-rw-r--r--src/testdir/test_cmdline.vim20
-rw-r--r--src/version.c2
3 files changed, 30 insertions, 1 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 9583d9a8f..3a1760f39 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -4216,6 +4216,11 @@ set_context_in_map_cmd(
arg = skipwhite(arg + 8);
continue;
}
+ if (STRNCMP(arg, "<special>", 9) == 0)
+ {
+ arg = skipwhite(arg + 9);
+ continue;
+ }
#ifdef FEAT_EVAL
if (STRNCMP(arg, "<script>", 8) == 0)
{
@@ -4267,7 +4272,7 @@ ExpandMappings(
{
count = 0;
- for (i = 0; i < 6; ++i)
+ for (i = 0; i < 7; ++i)
{
if (i == 0)
p = (char_u *)"<silent>";
@@ -4285,6 +4290,8 @@ ExpandMappings(
#endif
else if (i == 5)
p = (char_u *)"<nowait>";
+ else if (i == 6)
+ p = (char_u *)"<special>";
else
continue;
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 05beb45c9..8d5ae286e 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -25,6 +25,26 @@ func Test_complete_wildmenu()
set nowildmenu
endfunc
+func Test_map_completion()
+ if !has('cmdline_compl')
+ return
+ endif
+ call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
+ call assert_equal('"map <unique> <silent>', getreg(':'))
+ call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt')
+ call assert_equal('"map <script> <unique>', getreg(':'))
+ call feedkeys(":map <expr> <sc\<Tab>\<Home>\"\<CR>", 'xt')
+ call assert_equal('"map <expr> <script>', getreg(':'))
+ call feedkeys(":map <buffer> <e\<Tab>\<Home>\"\<CR>", 'xt')
+ call assert_equal('"map <buffer> <expr>', getreg(':'))
+ call feedkeys(":map <nowait> <b\<Tab>\<Home>\"\<CR>", 'xt')
+ call assert_equal('"map <nowait> <buffer>', getreg(':'))
+ call feedkeys(":map <special> <no\<Tab>\<Home>\"\<CR>", 'xt')
+ call assert_equal('"map <special> <nowait>', getreg(':'))
+ call feedkeys(":map <silent> <sp\<Tab>\<Home>\"\<CR>", 'xt')
+ call assert_equal('"map <silent> <special>', getreg(':'))
+endfunc
+
func Test_match_completion()
if !has('cmdline_compl')
return
diff --git a/src/version.c b/src/version.c
index 932132d48..e10968785 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 402,
+/**/
401,
/**/
400,