Patch 8.2.4551
Problem:    When mapping <Esc> terminal codes are not recognized.
Solution:   Specifically recognize a mapping with just <Esc> and check for
            terminal codes even though there is no partial mapping.
            (closes #9903)
Files:      src/getchar.c, src/testdir/test_termcodes.vim


*** ../vim-8.2.4550/src/getchar.c       2022-03-04 19:22:32.713730341 +0000
--- src/getchar.c       2022-03-12 13:41:48.091104099 +0000
***************
*** 2643,2649 ****
            max_mlen = mlen + 1;
      }
  
!     if ((mp == NULL || max_mlen > mp_match_len) && keylen != KEYLEN_PART_MAP)
      {
        int     save_keylen = keylen;
  
--- 2643,2654 ----
            max_mlen = mlen + 1;
      }
  
!     // May check for a terminal code when there is no mapping or only a 
partial
!     // mapping.  Also check if there is a full mapping with <Esc>, unless 
timed
!     // out, since that is nearly always a partial match with a terminal code.
!     if ((mp == NULL || max_mlen > mp_match_len
!                   || (mp_match_len == 1 && *mp->m_keys == ESC && !*timedout))
!           && keylen != KEYLEN_PART_MAP)
      {
        int     save_keylen = keylen;
  
*** ../vim-8.2.4550/src/testdir/test_termcodes.vim      2022-03-04 
19:22:32.713730341 +0000
--- src/testdir/test_termcodes.vim      2022-03-12 13:40:32.055290647 +0000
***************
*** 2331,2336 ****
--- 2331,2352 ----
    set timeoutlen&
  endfunc
  
+ func Test_mapping_esc()
+   set timeoutlen=10
+ 
+   new
+   nnoremap <Up> iHello<Esc>
+   nnoremap <Esc> <Nop>
+ 
+   call feedkeys(substitute(&t_ku, '\*', '', 'g'), 'Lx!')
+   call assert_equal("Hello", getline(1))
+ 
+   bwipe!
+   nunmap <Up>
+   nunmap <Esc>
+   set timeoutlen&
+ endfunc
+ 
  " Test for translation of special key codes (<xF1>, <xF2>, etc.)
  func Test_Keycode_Translation()
    let keycodes = [
*** ../vim-8.2.4550/src/version.c       2022-03-12 12:21:24.234165379 +0000
--- src/version.c       2022-03-12 13:33:00.604487140 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4551,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
242. You turn down a better-paying job because it doesn't come with
     a free e-mail account.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220312134932.C51CB1C79E4%40moolenaar.net.

Raspunde prin e-mail lui