Patch 8.2.5058

7 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 5, 2022, 2:53:10 PM6/5/22
to vim...@googlegroups.com

Patch 8.2.5058
Problem: input() does not handle composing characters properly.
Solution: Use mb_cptr2char_adv() instead of mb_ptr2char_adv().
(closes #10527)
Files: src/getchar.c, src/testdir/test_functions.vim


*** ../vim-8.2.5057/src/getchar.c 2022-05-07 20:01:10.058731693 +0100
--- src/getchar.c 2022-06-05 18:55:39.764503940 +0100
***************
*** 669,675 ****
}
else
{
! c = mb_ptr2char_adv(&s);
if (c == CAR || c == NL || c == ESC)
c = ' ';
stuffcharReadbuff(c);
--- 669,675 ----
}
else
{
! c = mb_cptr2char_adv(&s);
if (c == CAR || c == NL || c == ESC)
c = ' ';
stuffcharReadbuff(c);
*** ../vim-8.2.5057/src/testdir/test_functions.vim 2022-05-26 12:10:33.589893490 +0100
--- src/testdir/test_functions.vim 2022-06-05 18:55:39.764503940 +0100
***************
*** 1545,1550 ****
--- 1545,1554 ----
call feedkeys(":let c = input('name? ', \"x\\<BS>y\")\<CR>\<CR>", 'xt')
call assert_equal('y', c)

+ " Test for using text with composing characters as default input
+ call feedkeys(":let c = input('name? ', \"ã̳\")\<CR>\<CR>", 'xt')
+ call assert_equal('ã̳', c)
+
" Test for using <CR> as default input
call feedkeys(":let c = input('name? ', \"\\<CR>\")\<CR>x\<CR>", 'xt')
call assert_equal(' x', c)
*** ../vim-8.2.5057/src/version.c 2022-06-05 16:55:50.702774344 +0100
--- src/version.c 2022-06-05 18:59:15.960457235 +0100
***************
*** 736,737 ****
--- 736,739 ----
{ /* Add new patch number below this line */
+ /**/
+ 5058,
/**/

--
If your life is a hard drive,
Christ can be your backup.

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages