patch 9.2.0629: 0x80 and 0x9b byte not unescaped when check for valid abbr

Commit: 
https://github.com/vim/vim/commit/1958c991a8663749f2a56009cc65694d292a2a87
Author: zeertzjq <[email protected]>
Date:   Sat Jun 13 15:59:45 2026 +0000

    patch 9.2.0629: 0x80 and 0x9b byte not unescaped when check for valid abbr
    
    Problem:  0x80 and 0x9b byte not unescaped when checking for valid abbr
              (Mao-Yining)
    Solution: Use mb_unescape() (zeertzjq).
    
    fixes:  #20506
    closes: #20508
    
    Signed-off-by: zeertzjq <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/map.c b/src/map.c
index 34e465ec3..50d7ee4bc 100644
--- a/src/map.c
+++ b/src/map.c
@@ -662,18 +662,24 @@ do_map(
                {
                    int first, last;
                    int same = -1;
+                   char_u *p_char;
 
-                   first = vim_iswordp(keys);
+                   p = keys;
+                   p_char = mb_unescape(&p);
+                   if (p_char == NULL)
+                       p_char = p++;
+                   first = vim_iswordp(p_char);
                    last = first;
-                   p = keys + (*mb_ptr2len)(keys);
                    n = 1;
                    while (p < keys + len)
                    {
-                       ++n;                    // nr of (multi-byte) chars
-                       last = vim_iswordp(p);  // type of last char
+                       ++n;                         // nr of (multi-byte) chars
+                       p_char = mb_unescape(&p);
+                       if (p_char == NULL)
+                           p_char = p++;
+                       last = vim_iswordp(p_char);  // type of last char
                        if (same == -1 && last != first)
-                           same = n - 1;       // count of same char type
-                       p += (*mb_ptr2len)(p);
+                           same = n - 1;            // count of same char type
                    }
                    if (last && n > 2 && same >= 0 && same < n - 1)
                    {
diff --git a/src/testdir/test_mapping.vim b/src/testdir/test_mapping.vim
index 29f42848d..635193ebd 100644
--- a/src/testdir/test_mapping.vim
+++ b/src/testdir/test_mapping.vim
@@ -5,11 +5,29 @@ import './util/vim9.vim' as v9
 
 func Test_abbreviation()
   new
-  " abbreviation with 0x80 should work
+
+  " abbreviation with 0x80 (full-id)
   inoreab чкпр   vim
   call feedkeys("Goчкпр \<Esc>", "xt")
   call assert_equal('vim ', getline('$'))
   iunab чкпр
+
+  " abbreviation with 0x80 (non-id)
+  inoreab abc⁀ abc^
+  inoreab ⁀ ^
+  call feedkeys("Goabc⁀ def⁀ ⁀ \<Esc>", "xt")
+  call assert_equal('abc^ def⁀ ^ ', getline('$'))
+  iunab abc⁀
+  iunab ⁀
+
+  " abbreviation with 0x9b (non-id)
+  inoreab abc; abc;
+  inoreab ; ;
+  call feedkeys("Goabc; def; ; \<Esc>", "xt")
+  call assert_equal('abc; def; ; ', getline('$'))
+  iunab abc;
+  iunab ;
+
   bwipe!
 endfunc
 
diff --git a/src/version.c b/src/version.c
index 90ec1dc43..4d961bdeb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    629,
 /**/
     628,
 /**/

-- 
-- 
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 visit 
https://groups.google.com/d/msgid/vim_dev/E1wYR0h-00DFp9-TS%40256bit.org.

Raspunde prin e-mail lui