0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.3304: popup window title with wide characters is truncated

Problem:    Popup window title with wide characters is truncated.
Solution:   Use vim_strsize() instead of MB_CHARLEN(). (Naruhiko Nishino,
            closes #8721)
This commit is contained in:
rbtnn 2021-08-07 13:08:45 +02:00 committed by Bram Moolenaar
parent 3276f5846f
commit c611941c60
4 changed files with 5 additions and 3 deletions

View File

@ -3896,7 +3896,7 @@ update_popups(void (*win_update)(win_T *wp))
title_wincol = wp->w_wincol + 1; title_wincol = wp->w_wincol + 1;
if (wp->w_popup_title != NULL) if (wp->w_popup_title != NULL)
{ {
title_len = (int)MB_CHARLEN(wp->w_popup_title); title_len = vim_strsize(wp->w_popup_title);
// truncate the title if too long // truncate the title if too long
if (title_len > total_width - 2) if (title_len > total_width - 2)

View File

@ -1,7 +1,7 @@
>1+0&#ffffff0| @73 >1+0&#ffffff0| @73
|2| @73 |2| @73
|3| @73 |3| @73
|4| @25|╔+0#0000001#ffd7ff255|▶|Ä|Ö|Ü|◀|═@12|╗| +0#0000000#ffffff0@27 |4| @25|╔+0#0000001#ffd7ff255|▶|Ä|あ*&|い|う|え|お|◀+&|═@4|╗| +0#0000000#ffffff0@27
|5| @25|║+0#0000001#ffd7ff255| |T+0&#e0e0e08|h|i|s| |i|s| |a| |l|i|n|e| @1| +0&#ffd7ff255|║| +0#0000000#ffffff0@27 |5| @25|║+0#0000001#ffd7ff255| |T+0&#e0e0e08|h|i|s| |i|s| |a| |l|i|n|e| @1| +0&#ffd7ff255|║| +0#0000000#ffffff0@27
|6| @25|║+0#0000001#ffd7ff255| |a|n|d| |a|n|o|t|h|e|r| |l|i|n|e| |║| +0#0000000#ffffff0@27 |6| @25|║+0#0000001#ffd7ff255| |a|n|d| |a|n|o|t|h|e|r| |l|i|n|e| |║| +0#0000000#ffffff0@27
|7| @25|╚+0#0000001#ffd7ff255|═@17|╝| +0#0000000#ffffff0@27 |7| @25|╚+0#0000001#ffd7ff255|═@17|╝| +0#0000000#ffffff0@27

View File

@ -1817,7 +1817,7 @@ func Test_popup_title()
call VerifyScreenDump(buf, 'Test_popupwin_longtitle_4', {}) call VerifyScreenDump(buf, 'Test_popupwin_longtitle_4', {})
call term_sendkeys(buf, ":call popup_clear()\<CR>") call term_sendkeys(buf, ":call popup_clear()\<CR>")
call term_sendkeys(buf, ":call popup_menu(['This is a line', 'and another line'], #{title: '▶ÄÖÜ◀', })\<CR>") call term_sendkeys(buf, ":call popup_menu(['This is a line', 'and another line'], #{title: '▶Äあいうえお◀', })\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_multibytetitle', {}) call VerifyScreenDump(buf, 'Test_popupwin_multibytetitle', {})
call term_sendkeys(buf, "x") call term_sendkeys(buf, "x")

View File

@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3304,
/**/ /**/
3303, 3303,
/**/ /**/