0
0
mirror of https://github.com/vim/vim.git synced 2025-10-04 05:25:06 -04:00

patch 8.1.2083: multi-byte chars do not work properly with "%.*S" in printf()

Problem:    Multi-byte chars do not work properly with "%.*S" in printf().
Solution:   Use mb_ptr2cells(). Daniel Hahler, closes #4989)
This commit is contained in:
Bram Moolenaar
2019-09-27 13:32:06 +02:00
parent 30e8e73506
commit ce0fac2897
3 changed files with 14 additions and 5 deletions

View File

@@ -248,6 +248,9 @@ function Test_printf_misc()
call assert_equal('abc ', printf('%-4s', 'abc'))
call assert_equal('abc ', printf('%-4S', 'abc'))
call assert_equal('🐍', printf('%.2S', '🐍🐍'))
call assert_equal('', printf('%.1S', '🐍🐍'))
call assert_equal('1%', printf('%d%%', 1))
endfunc