1
0
forked from aniani/vim

patch 8.1.2159: some mappings are listed twice

Problem:    Some mappings are listed twice.
Solution:   Skip mappings duplicated for modifyOtherKeys. (closes #5064)
This commit is contained in:
Bram Moolenaar 2019-10-16 18:34:57 +02:00
parent 17efc7fa05
commit fafb4b18cd
3 changed files with 31 additions and 6 deletions

View File

@ -554,7 +554,7 @@ do_map(
for ( ; mp != NULL && !got_int; mp = mp->m_next)
{
// check entries with the same mode
if ((mp->m_mode & mode) != 0)
if (!mp->m_simplified && (mp->m_mode & mode) != 0)
{
if (!haskey) // show all entries
{
@ -599,16 +599,20 @@ do_map(
for (mp = *mpp; mp != NULL && !got_int; mp = *mpp)
{
if (!(mp->m_mode & mode)) // skip entries with wrong mode
if ((mp->m_mode & mode) == 0)
{
// skip entries with wrong mode
mpp = &(mp->m_next);
continue;
}
if (!haskey) // show all entries
{
if (!mp->m_simplified)
{
showmap(mp, map_table != maphash);
did_it = TRUE;
}
}
else // do we have a match?
{
if (round) // second round: Try unmap "rhs" string
@ -642,10 +646,13 @@ do_map(
did_it = TRUE; // remember we did something
}
else if (!hasarg) // show matching entry
{
if (!mp->m_simplified)
{
showmap(mp, map_table != maphash);
did_it = TRUE;
}
}
else if (n != len) // new entry is ambiguous
{
mpp = &(mp->m_next);

View File

@ -442,3 +442,19 @@ func Test_error_in_map_expr()
call delete('Xtest.vim')
exe buf .. 'bwipe!'
endfunc
func Test_list_mappings()
inoremap <C-M> CtrlM
inoremap <A-S> AltS
inoremap <S-/> ShiftSlash
call assert_equal([
\ 'i <S-/> * ShiftSlash',
\ 'i <M-S> * AltS',
\ 'i <C-M> * CtrlM',
\], execute('imap')->trim()->split("\n"))
iunmap <C-M>
iunmap <A-S>
call assert_equal(['i <S-/> * ShiftSlash'], execute('imap')->trim()->split("\n"))
iunmap <S-/>
call assert_equal(['No mapping found'], execute('imap')->trim()->split("\n"))
endfunc

View File

@ -753,6 +753,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2159,
/**/
2158,
/**/