mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 22:18:33 +00:00
vim-patch:8.1.2159: some mappings are listed twice
Problem: Some mappings are listed twice.
Solution: Skip mappings duplicated for modifyOtherKeys. (closes vim/vim#5064)
fafb4b18cd
This commit is contained in:
@@ -3065,7 +3065,7 @@ int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev, buf_T
|
|||||||
}
|
}
|
||||||
for (; mp != NULL && !got_int; mp = mp->m_next) {
|
for (; mp != NULL && !got_int; mp = mp->m_next) {
|
||||||
// check entries with the same mode
|
// check entries with the same mode
|
||||||
if ((mp->m_mode & mode) != 0) {
|
if (!mp->m_simplified && (mp->m_mode & mode) != 0) {
|
||||||
if (!has_lhs) { // show all entries
|
if (!has_lhs) { // show all entries
|
||||||
showmap(mp, true);
|
showmap(mp, true);
|
||||||
did_local = true;
|
did_local = true;
|
||||||
@@ -3100,13 +3100,16 @@ int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev, buf_T
|
|||||||
mpp = &(map_table[hash]);
|
mpp = &(map_table[hash]);
|
||||||
}
|
}
|
||||||
for (mp = *mpp; mp != NULL && !got_int; mp = *mpp) {
|
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);
|
mpp = &(mp->m_next);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!has_lhs) { // show all entries
|
if (!has_lhs) { // show all entries
|
||||||
|
if (!mp->m_simplified) {
|
||||||
showmap(mp, map_table != maphash);
|
showmap(mp, map_table != maphash);
|
||||||
did_it = true;
|
did_it = true;
|
||||||
|
}
|
||||||
} else { // do we have a match?
|
} else { // do we have a match?
|
||||||
if (round) { // second round: Try unmap "rhs" string
|
if (round) { // second round: Try unmap "rhs" string
|
||||||
n = (int)STRLEN(mp->m_str);
|
n = (int)STRLEN(mp->m_str);
|
||||||
@@ -3132,8 +3135,10 @@ int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev, buf_T
|
|||||||
mp->m_mode &= ~mode;
|
mp->m_mode &= ~mode;
|
||||||
did_it = true; // remember we did something
|
did_it = true; // remember we did something
|
||||||
} else if (!has_rhs) { // show matching entry
|
} else if (!has_rhs) { // show matching entry
|
||||||
|
if (!mp->m_simplified) {
|
||||||
showmap(mp, map_table != maphash);
|
showmap(mp, map_table != maphash);
|
||||||
did_it = true;
|
did_it = true;
|
||||||
|
}
|
||||||
} else if (n != len) { // new entry is ambiguous
|
} else if (n != len) { // new entry is ambiguous
|
||||||
mpp = &(mp->m_next);
|
mpp = &(mp->m_next);
|
||||||
continue;
|
continue;
|
||||||
|
@@ -429,6 +429,22 @@ func Test_error_in_map_expr()
|
|||||||
exe buf .. 'bwipe!'
|
exe buf .. 'bwipe!'
|
||||||
endfunc
|
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
|
||||||
|
|
||||||
func Test_expr_map_gets_cursor()
|
func Test_expr_map_gets_cursor()
|
||||||
new
|
new
|
||||||
call setline(1, ['one', 'some w!rd'])
|
call setline(1, ['one', 'some w!rd'])
|
||||||
|
Reference in New Issue
Block a user