From 9afefd32d3938a50a023355af86ec3293a047130 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 16 Jan 2022 17:37:06 +0800 Subject: vim-patch:8.2.3630: printf() with %S does not handle multi-byte correctly Problem: Printf() with %S does not handle multi-byte correctly. Solution: Count cells instead of bytes. (closes vim/vim#9169, closes vim/vim#7486) https://github.com/vim/vim/commit/d85fccdfed58108c4e0958d0b17c64690b5f073f --- src/nvim/testdir/test_expr.vim | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/nvim/testdir/test_expr.vim') diff --git a/src/nvim/testdir/test_expr.vim b/src/nvim/testdir/test_expr.vim index 1d7fd3e385..447a519f2c 100644 --- a/src/nvim/testdir/test_expr.vim +++ b/src/nvim/testdir/test_expr.vim @@ -283,6 +283,11 @@ function Test_printf_misc() call assert_equal('🐍', printf('%.2S', '🐍🐍')) call assert_equal('', printf('%.1S', '🐍🐍')) + call assert_equal('[ あいう]', printf('[%10.6S]', 'あいうえお')) + call assert_equal('[ あいうえ]', printf('[%10.8S]', 'あいうえお')) + call assert_equal('[あいうえお]', printf('[%10.10S]', 'あいうえお')) + call assert_equal('[あいうえお]', printf('[%10.12S]', 'あいうえお')) + call assert_equal('1%', printf('%d%%', 1)) endfunc -- cgit