1
0
forked from aniani/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 #9169, closes #7486)
This commit is contained in:
presuku
2021-11-20 19:38:31 +00:00
committed by Bram Moolenaar
parent a119812437
commit d85fccdfed
3 changed files with 16 additions and 4 deletions

View File

@@ -297,6 +297,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