]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.1257: Mixing vim_strsize() with mb_ptr2cells() in pum_redraw() v9.1.1257
authorzeertzjq <zeertzjq@outlook.com>
Sat, 29 Mar 2025 08:05:52 +0000 (09:05 +0100)
committerChristian Brabandt <cb@256bit.org>
Sat, 29 Mar 2025 08:05:52 +0000 (09:05 +0100)
commit90e52490b39f0052fb5313d67728eff77191aaae
treeba2746e4e0f0fe859a0f61db9de891c3a303f47e
parent0dc9a0bc60d469f52db064fc88ed9d8938fb5cc3
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 <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/popupmenu.c
src/version.c