vim-patch:9.0.1329: completion of map includes simplified ones (#22335)

Problem:    Completion of map includes simplified ones.
Solution:   Do not complete simplified mappings. (closes vim/vim#12013)

997b8a015c
This commit is contained in:
zeertzjq
2023-02-20 08:24:49 +08:00
committed by GitHub
parent 020d3e355e
commit 8784f064f1
2 changed files with 6 additions and 5 deletions

View File

@@ -1342,7 +1342,7 @@ int ExpandMappings(char *pat, regmatch_T *regmatch, int *numMatches, char ***mat
mp = maphash[hash]; mp = maphash[hash];
} }
for (; mp; mp = mp->m_next) { for (; mp; mp = mp->m_next) {
if (!(mp->m_mode & expand_mapmodes)) { if (mp->m_simplified || !(mp->m_mode & expand_mapmodes)) {
continue; continue;
} }

View File

@@ -759,11 +759,12 @@ func Test_mapcomplete()
call feedkeys(":abbr! \<C-A>\<C-B>\"\<CR>", 'tx') call feedkeys(":abbr! \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal("\"abbr! \x01", @:) call assert_equal("\"abbr! \x01", @:)
" Multiple matches for a map " When multiple matches have the same {lhs}, it should only appear once.
nmap ,f /H<CR> " The simplified form should also not be included.
omap ,f /H<CR> nmap ,<C-F> /H<CR>
omap ,<C-F> /H<CR>
call feedkeys(":map ,\<C-A>\<C-B>\"\<CR>", 'tx') call feedkeys(":map ,\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"map ,f', @:) call assert_equal('"map ,<C-F>', @:)
mapclear mapclear
endfunc endfunc