To: vim_dev@googlegroups.com Subject: Patch 8.1.2159 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2159 Problem: Some mappings are listed twice. Solution: Skip mappings duplicated for modifyOtherKeys. (closes #5064) Files: src/map.c, src/testdir/test_mapping.vim *** ../vim-8.1.2158/src/map.c 2019-10-13 16:43:35.956359658 +0200 --- src/map.c 2019-10-16 18:33:32.048647070 +0200 *************** *** 554,560 **** for ( ; mp != NULL && !got_int; mp = mp->m_next) { // check entries with the same mode ! if ((mp->m_mode & mode) != 0) { if (!haskey) // show all entries { --- 554,560 ---- for ( ; mp != NULL && !got_int; mp = mp->m_next) { // check entries with the same mode ! if (!mp->m_simplified && (mp->m_mode & mode) != 0) { if (!haskey) // show all entries { *************** *** 599,613 **** for (mp = *mpp; mp != NULL && !got_int; mp = *mpp) { ! if (!(mp->m_mode & mode)) // skip entries with wrong mode { mpp = &(mp->m_next); continue; } if (!haskey) // show all entries { ! showmap(mp, map_table != maphash); ! did_it = TRUE; } else // do we have a match? { --- 599,617 ---- for (mp = *mpp; mp != NULL && !got_int; mp = *mpp) { ! 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? { *************** *** 643,650 **** } else if (!hasarg) // show matching entry { ! showmap(mp, map_table != maphash); ! did_it = TRUE; } else if (n != len) // new entry is ambiguous { --- 647,657 ---- } 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 { *** ../vim-8.1.2158/src/testdir/test_mapping.vim 2019-08-16 21:47:23.870692859 +0200 --- src/testdir/test_mapping.vim 2019-10-16 18:31:30.809166905 +0200 *************** *** 442,444 **** --- 442,460 ---- call delete('Xtest.vim') exe buf .. 'bwipe!' endfunc + + func Test_list_mappings() + inoremap CtrlM + inoremap AltS + inoremap ShiftSlash + call assert_equal([ + \ 'i * ShiftSlash', + \ 'i * AltS', + \ 'i * CtrlM', + \], execute('imap')->trim()->split("\n")) + iunmap + iunmap + call assert_equal(['i * ShiftSlash'], execute('imap')->trim()->split("\n")) + iunmap + call assert_equal(['No mapping found'], execute('imap')->trim()->split("\n")) + endfunc *** ../vim-8.1.2158/src/version.c 2019-10-16 18:11:13.706363954 +0200 --- src/version.c 2019-10-16 18:23:02.095346287 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 2159, /**/ -- Another bucket of what can only be described as human ordure hits ARTHUR. ARTHUR: ... Right! (to the KNIGHTS) That settles it! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///