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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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];
}
for (; mp; mp = mp->m_next) {
if (!(mp->m_mode & expand_mapmodes)) {
if (mp->m_simplified || !(mp->m_mode & expand_mapmodes)) {
continue;
}

View File

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