From: zeertzjq Date: Sun, 5 Jun 2022 18:01:37 +0000 (+0100) Subject: patch 8.2.5058: input() does not handle composing characters properly X-Git-Tag: v8.2.5058 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e3a529bc877909a9eccf792461050b4f6737ed33;p=vim 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) --- diff --git a/src/getchar.c b/src/getchar.c index 55fad1cb2..03d90ac87 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -669,7 +669,7 @@ stuffReadbuffSpec(char_u *s) } else { - c = mb_ptr2char_adv(&s); + c = mb_cptr2char_adv(&s); if (c == CAR || c == NL || c == ESC) c = ' '; stuffcharReadbuff(c); diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index af07a6424..f55e846fa 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -1545,6 +1545,10 @@ func Test_input_func() call feedkeys(":let c = input('name? ', \"x\\y\")\\", 'xt') call assert_equal('y', c) + " Test for using text with composing characters as default input + call feedkeys(":let c = input('name? ', \"ã̳\")\\", 'xt') + call assert_equal('ã̳', c) + " Test for using as default input call feedkeys(":let c = input('name? ', \"\\\")\x\", 'xt') call assert_equal(' x', c) diff --git a/src/version.c b/src/version.c index 254b5f1f8..744fad661 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 5058, /**/ 5057, /**/