Patch 8.2.4504
Problem: When there is a partially matching map and modifyOtherKeys is
active a full map may not work.
Solution: Only simplify modifiers when there is no matching mapping.
(closes #8792)
Files: src/getchar.c, src/testdir/test_termcodes.vim
*** ../vim-8.2.4503/src/getchar.c 2022-03-04 14:51:02.283560533 +0000
--- src/getchar.c 2022-03-04 19:21:17.325767373 +0000
***************
*** 2598,2604 ****
}
// If no partly match found, use the longest full match.
! if (keylen != KEYLEN_PART_MAP)
{
mp = mp_match;
keylen = mp_match_len;
--- 2598,2604 ----
}
// If no partly match found, use the longest full match.
! if (keylen != KEYLEN_PART_MAP && mp_match != NULL)
{
mp = mp_match;
keylen = mp_match_len;
***************
*** 2643,2649 ****
max_mlen = mlen + 1;
}
! if ((mp == NULL || max_mlen >= mp_match_len) && keylen != KEYLEN_PART_MAP)
{
int save_keylen = keylen;
--- 2643,2649 ----
max_mlen = mlen + 1;
}
! if ((mp == NULL || max_mlen > mp_match_len) && keylen != KEYLEN_PART_MAP)
{
int save_keylen = keylen;
*** ../vim-8.2.4503/src/testdir/test_termcodes.vim 2021-12-05 12:39:15.094817940 +0000
--- src/testdir/test_termcodes.vim 2022-03-04 19:20:07.709801078 +0000
***************
*** 2098,2103 ****
--- 2098,2120 ----
set timeoutlen&
endfunc
+ func Test_modifyOtherKeys_ambiguous_mapping()
+ new
+ set timeoutlen=10
+ map <C-J> a
+ map <C-J>x <Nop>
+ call setline(1, 'x')
+
+ " CTRL-J b should have trigger the <C-J> mapping and then insert "b"
+ call feedkeys(GetEscCodeCSI27('J', 5) .. "b\<Esc>", 'Lx!')
+ call assert_equal('xb', getline(1))
+
+ unmap <C-J>
+ unmap <C-J>x
+ set timeoutlen&
+ bwipe!
+ endfunc
+
" Whether Shift-Tab sends "ESC [ Z" or "ESC [ 27 ; 2 ; 9 ~" is unpredictable,
" both should work.
func Test_modifyOtherKeys_shift_tab()
*** ../vim-8.2.4503/src/version.c 2022-03-04 17:10:15.959626537 +0000
--- src/version.c 2022-03-04 19:03:41.638152795 +0000
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 4504,
/**/
--
hundred-and-one symptoms of being an internet addict:
165. You have a web page burned into your glasses
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///