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:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user