Skip to content

Commit cf5fdf7

Browse files
committed
patch 8.0.0402: :map completion does not have <special>
Problem: :map completion does not have <special>. (Dominique Pelle) Solution: Recognize <special> in completion. Add a test.
1 parent a0107bd commit cf5fdf7

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

src/getchar.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4216,6 +4216,11 @@ set_context_in_map_cmd(
42164216
arg = skipwhite(arg + 8);
42174217
continue;
42184218
}
4219+
if (STRNCMP(arg, "<special>", 9) == 0)
4220+
{
4221+
arg = skipwhite(arg + 9);
4222+
continue;
4223+
}
42194224
#ifdef FEAT_EVAL
42204225
if (STRNCMP(arg, "<script>", 8) == 0)
42214226
{
@@ -4267,7 +4272,7 @@ ExpandMappings(
42674272
{
42684273
count = 0;
42694274

4270-
for (i = 0; i < 6; ++i)
4275+
for (i = 0; i < 7; ++i)
42714276
{
42724277
if (i == 0)
42734278
p = (char_u *)"<silent>";
@@ -4285,6 +4290,8 @@ ExpandMappings(
42854290
#endif
42864291
else if (i == 5)
42874292
p = (char_u *)"<nowait>";
4293+
else if (i == 6)
4294+
p = (char_u *)"<special>";
42884295
else
42894296
continue;
42904297

src/testdir/test_cmdline.vim

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,26 @@ func Test_complete_wildmenu()
2525
set nowildmenu
2626
endfunc
2727

28+
func Test_map_completion()
29+
if !has('cmdline_compl')
30+
return
31+
endif
32+
call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
33+
call assert_equal('"map <unique> <silent>', getreg(':'))
34+
call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt')
35+
call assert_equal('"map <script> <unique>', getreg(':'))
36+
call feedkeys(":map <expr> <sc\<Tab>\<Home>\"\<CR>", 'xt')
37+
call assert_equal('"map <expr> <script>', getreg(':'))
38+
call feedkeys(":map <buffer> <e\<Tab>\<Home>\"\<CR>", 'xt')
39+
call assert_equal('"map <buffer> <expr>', getreg(':'))
40+
call feedkeys(":map <nowait> <b\<Tab>\<Home>\"\<CR>", 'xt')
41+
call assert_equal('"map <nowait> <buffer>', getreg(':'))
42+
call feedkeys(":map <special> <no\<Tab>\<Home>\"\<CR>", 'xt')
43+
call assert_equal('"map <special> <nowait>', getreg(':'))
44+
call feedkeys(":map <silent> <sp\<Tab>\<Home>\"\<CR>", 'xt')
45+
call assert_equal('"map <silent> <special>', getreg(':'))
46+
endfunc
47+
2848
func Test_match_completion()
2949
if !has('cmdline_compl')
3050
return

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
402,
767769
/**/
768770
401,
769771
/**/

0 commit comments

Comments
 (0)