To: vim_dev@googlegroups.com Subject: Patch 8.2.3304 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3304 Problem: Popup window title with wide characters is truncated. Solution: Use vim_strsize() instead of MB_CHARLEN(). (Naruhiko Nishino, closes #8721) Files: src/popupwin.c, src/testdir/test_popupwin.vim, src/testdir/dumps/Test_popupwin_multibytetitle.dump *** ../vim-8.2.3303/src/popupwin.c 2021-07-27 22:00:39.749712387 +0200 --- src/popupwin.c 2021-08-07 13:06:55.429166522 +0200 *************** *** 3896,3902 **** title_wincol = wp->w_wincol + 1; if (wp->w_popup_title != NULL) { ! title_len = (int)MB_CHARLEN(wp->w_popup_title); // truncate the title if too long if (title_len > total_width - 2) --- 3896,3902 ---- title_wincol = wp->w_wincol + 1; if (wp->w_popup_title != NULL) { ! title_len = vim_strsize(wp->w_popup_title); // truncate the title if too long if (title_len > total_width - 2) *** ../vim-8.2.3303/src/testdir/test_popupwin.vim 2021-07-04 14:00:52.129474931 +0200 --- src/testdir/test_popupwin.vim 2021-08-07 13:03:51.441169698 +0200 *************** *** 1817,1823 **** call VerifyScreenDump(buf, 'Test_popupwin_longtitle_4', {}) call term_sendkeys(buf, ":call popup_clear()\") ! call term_sendkeys(buf, ":call popup_menu(['This is a line', 'and another line'], #{title: '▶ÄÖÜ◀', })\") call VerifyScreenDump(buf, 'Test_popupwin_multibytetitle', {}) call term_sendkeys(buf, "x") --- 1817,1823 ---- call VerifyScreenDump(buf, 'Test_popupwin_longtitle_4', {}) call term_sendkeys(buf, ":call popup_clear()\") ! call term_sendkeys(buf, ":call popup_menu(['This is a line', 'and another line'], #{title: '▶Äあいうえお◀', })\") call VerifyScreenDump(buf, 'Test_popupwin_multibytetitle', {}) call term_sendkeys(buf, "x") *** ../vim-8.2.3303/src/testdir/dumps/Test_popupwin_multibytetitle.dump 2021-05-28 14:11:59.725797039 +0200 --- src/testdir/dumps/Test_popupwin_multibytetitle.dump 2021-08-07 13:07:11.881158999 +0200 *************** *** 1,7 **** >1+0&#ffffff0| @73 |2| @73 |3| @73 ! |4| @25|╔+0#0000001#ffd7ff255|▶|Ä|Ö|Ü|◀|═@12|╗| +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 |7| @25|╚+0#0000001#ffd7ff255|═@17|╝| +0#0000000#ffffff0@27 --- 1,7 ---- >1+0&#ffffff0| @73 |2| @73 |3| @73 ! |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 |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 *** ../vim-8.2.3303/src/version.c 2021-08-07 12:44:37.836256707 +0200 --- src/version.c 2021-08-07 13:05:12.793188132 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3304, /**/ -- WOMAN: Dennis, there's some lovely filth down here. Oh -- how d'you do? ARTHUR: How do you do, good lady. I am Arthur, King of the Britons. Who's castle is that? WOMAN: King of the who? The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///