0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.5058: input() does not handle composing characters properly

Problem:    input() does not handle composing characters properly.
Solution:   Use mb_cptr2char_adv() instead of mb_ptr2char_adv().
            (closes #10527)
This commit is contained in:
zeertzjq
2022-06-05 19:01:37 +01:00
committed by Bram Moolenaar
parent 6574577cac
commit e3a529bc87
3 changed files with 7 additions and 1 deletions

View File

@@ -669,7 +669,7 @@ stuffReadbuffSpec(char_u *s)
} }
else else
{ {
c = mb_ptr2char_adv(&s); c = mb_cptr2char_adv(&s);
if (c == CAR || c == NL || c == ESC) if (c == CAR || c == NL || c == ESC)
c = ' '; c = ' ';
stuffcharReadbuff(c); stuffcharReadbuff(c);

View File

@@ -1545,6 +1545,10 @@ func Test_input_func()
call feedkeys(":let c = input('name? ', \"x\\<BS>y\")\<CR>\<CR>", 'xt') call feedkeys(":let c = input('name? ', \"x\\<BS>y\")\<CR>\<CR>", 'xt')
call assert_equal('y', c) 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 " Test for using <CR> as default input
call feedkeys(":let c = input('name? ', \"\\<CR>\")\<CR>x\<CR>", 'xt') call feedkeys(":let c = input('name? ', \"\\<CR>\")\<CR>x\<CR>", 'xt')
call assert_equal(' x', c) call assert_equal(' x', c)

View File

@@ -734,6 +734,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 */
/**/
5058,
/**/ /**/
5057, 5057,
/**/ /**/