patch 9.1.1257: Mixing vim_strsize() with mb_ptr2cells() in pum_redraw()

Commit: 
https://github.com/vim/vim/commit/90e52490b39f0052fb5313d67728eff77191aaae
Author: zeertzjq <zeert...@outlook.com>
Date:   Sat Mar 29 09:05:52 2025 +0100

    patch 9.1.1257: Mixing vim_strsize() with mb_ptr2cells() in pum_redraw()
    
    Problem:  Mixing vim_strsize() with mb_ptr2cells() in pum_redraw().
    Solution: Change vim_strsize() to mb_string2cells() (zeertzjq).
    
    Since vim_strsize() uses ptr2cells() for the cell width of each char, it
    is strange to mix it with mb_ptr2cells(), which is used both just below
    and in pum_screen_puts_with_attr(), and screen_puts_len() also uses
    something similar.  Meanwhile mb_string2cells() uses mb_ptr2cells() for
    the cell width of each char.
    
    Note that the vim_strsize() and mb_string2cells() actually return the
    same value here, as the transstr() above makes sure the string only
    contains printable chars, and ptr2cells() and mb_ptr2cells() only return
    different values for unprintable chars.
    
    closes: #17003
    
    Signed-off-by: zeertzjq <zeert...@outlook.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/popupmenu.c b/src/popupmenu.c
index 5a2f07031..71bb49984 100644
--- a/src/popupmenu.c
+++ b/src/popupmenu.c
@@ -731,7 +731,7 @@ pum_redraw(void)
                                char_u          *old_rt = NULL;
                                char_u          *orig_rt = NULL;
 
-                               cells = vim_strsize(rt);
+                               cells = mb_string2cells(rt, -1);
                                need_ellipsis = p_pmw > ellipsis_width
                                                    && pum_width == p_pmw
                                                    && cells > pum_width;
diff --git a/src/version.c b/src/version.c
index 2a83869a4..7d6c7e3f9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1257,
 /**/
     1256,
 /**/

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1tyRLM-004yIu-Kw%40256bit.org.

Raspunde prin e-mail lui