aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-01-16 17:37:06 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-01-16 17:37:06 +0800
commit9afefd32d3938a50a023355af86ec3293a047130 (patch)
tree9d3bad389ef267de8a2b38fd2e4a33dc0f466f27 /src/nvim/testdir
parent7085e5b0c8588618e643c87802afc515f67812d9 (diff)
downloadrneovim-9afefd32d3938a50a023355af86ec3293a047130.tar.gz
rneovim-9afefd32d3938a50a023355af86ec3293a047130.tar.bz2
rneovim-9afefd32d3938a50a023355af86ec3293a047130.zip
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
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_expr.vim5
1 files changed, 5 insertions, 0 deletions
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