Patch 8.2.4588
Problem:    Mapping with key code after other matching mapping does not work.
Solution:   Change ">" to ">=". (closes #9903)
Files:      src/getchar.c, src/testdir/test_termcodes.vim


*** ../vim-8.2.4587/src/getchar.c       2022-03-12 13:48:35.502586206 +0000
--- src/getchar.c       2022-03-18 15:40:18.918532782 +0000
***************
*** 2416,2421 ****
--- 2416,2422 ----
      mapblock_T        *mp_match;
      int               mp_match_len = 0;
      int               max_mlen = 0;
+     int               want_termcode = 0;  // 1 if termcode expected after 
max_mlen
      int               tb_c1;
      int               mlen;
  #ifdef FEAT_LANGMAP
***************
*** 2591,2599 ****
                }
                else
                    // No match; may have to check for termcode at next
!                   // character.
                    if (max_mlen < mlen)
                        max_mlen = mlen;
            }
        }
  
--- 2592,2607 ----
                }
                else
                    // No match; may have to check for termcode at next
!                   // character.  If the first character that didn't match is
!                   // K_SPECIAL then check for a termcode.  This isn't perfect
!                   // but should work in most cases.
                    if (max_mlen < mlen)
+                   {
                        max_mlen = mlen;
+                       want_termcode = mp->m_keys[mlen] == K_SPECIAL;
+                   }
+                   else if (max_mlen == mlen && mp->m_keys[mlen] == K_SPECIAL)
+                       want_termcode = 1;
            }
        }
  
***************
*** 2646,2652 ****
      // 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)
      {
--- 2654,2660 ----
      // 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 + want_termcode > mp_match_len
                    || (mp_match_len == 1 && *mp->m_keys == ESC && !*timedout))
            && keylen != KEYLEN_PART_MAP)
      {
*** ../vim-8.2.4587/src/testdir/test_termcodes.vim      2022-03-12 
13:48:35.502586206 +0000
--- src/testdir/test_termcodes.vim      2022-03-18 15:39:17.822571969 +0000
***************
*** 2111,2116 ****
--- 2111,2125 ----
  
    unmap <C-J>
    unmap <C-J>x
+ 
+   " if a special character is following there should be a check for a termcode
+   nnoremap s aX<Esc>
+   nnoremap s<BS> aY<Esc>
+   set t_kb= 
+   call setline(1, 'x')
+   call feedkeys("s\x08", 'Lx!')
+   call assert_equal('xY', getline(1))
+ 
    set timeoutlen&
    bwipe!
  endfunc
*** ../vim-8.2.4587/src/version.c       2022-03-18 13:10:45.403445014 +0000
--- src/version.c       2022-03-18 15:06:14.530670799 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4588,
  /**/

-- 
FIRST HEAD: All right! All right! We'll kill him first and then have tea and
            biscuits.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/20220318154146.BDF061C08FD%40moolenaar.net.

Raspunde prin e-mail lui