changeset 29073:c7bd1040a1c4 v8.2.5058

patch 8.2.5058: input() does not handle composing characters properly Commit: https://github.com/vim/vim/commit/e3a529bc877909a9eccf792461050b4f6737ed33 Author: zeertzjq <zeertzjq@outlook.com> Date: Sun Jun 5 19:01:37 2022 +0100 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)
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 Jun 2022 20:15:02 +0200
parents 44b520fb2185
children 21fc7b930c1e
files src/getchar.c src/testdir/test_functions.vim src/version.c
diffstat 3 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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\\<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)
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    5058,
+/**/
     5057,
 /**/
     5056,