]> granicus.if.org Git - vim/commitdiff
patch 8.1.2159: some mappings are listed twice v8.1.2159
authorBram Moolenaar <Bram@vim.org>
Wed, 16 Oct 2019 16:34:57 +0000 (18:34 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 16 Oct 2019 16:34:57 +0000 (18:34 +0200)
Problem:    Some mappings are listed twice.
Solution:   Skip mappings duplicated for modifyOtherKeys. (closes #5064)

src/map.c
src/testdir/test_mapping.vim
src/version.c

index 00f4608b07917da3a909b0d4d24299be862a2262..74fc60c1fcf930e5d8ca09c2eb7304f628a62ad9 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -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,15 +599,19 @@ 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
                    {
-                       showmap(mp, map_table != maphash);
-                       did_it = TRUE;
+                       if (!mp->m_simplified)
+                       {
+                           showmap(mp, map_table != maphash);
+                           did_it = TRUE;
+                       }
                    }
                    else        // do we have a match?
                    {
@@ -643,8 +647,11 @@ do_map(
                            }
                            else if (!hasarg)   // show matching entry
                            {
-                               showmap(mp, map_table != maphash);
-                               did_it = TRUE;
+                               if (!mp->m_simplified)
+                               {
+                                   showmap(mp, map_table != maphash);
+                                   did_it = TRUE;
+                               }
                            }
                            else if (n != len)  // new entry is ambiguous
                            {
index 93a4d4b85757fd3e4ea10c825bdd328dea703546..f62d5755ecec772c396f8b220d03cd8bccd48a4b 100644 (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
index 2042cb0f40afefdeea7e2c85408245625a79694f..91cffb330dc02e9aac6575e986b1661456f894e5 100644 (file)
@@ -753,6 +753,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2159,
 /**/
     2158,
 /**/