vim-patch:9.1.1479: regression when displaying localized percentage position

Problem:  regression when displaying localized percentage position
          (after v9.1.1291)
Solution: calculate percentage first (Emir SARI)

Cleanups made in ec032de broke the Turkish percent display, failing to
prepend it properly in cases between 0 and 10. In Turkish, the percent
sign is prepended to the number, so it was displaying it as `% 5`
(should have been `%5`), while displaying numbers bigger than 9 properly.

related: vim/vim#17597

8fe9e55a7d

The test was unskipped in Vim in patch 9.1.1479 which added Turkish
translation for "%d%%". However, Nvim has had Turkish translation for
"%d%%" since 2023, so don't skip the test.

Co-authored-by: Emir SARI <emir_sari@icloud.com>
This commit is contained in:
zeertzjq
2025-10-31 17:13:31 +08:00
parent d825e51169
commit a0f3fdba58
4 changed files with 65 additions and 10 deletions

View File

@@ -10,7 +10,6 @@ local command = n.command
local set_method_error = n.set_method_error
local api = n.api
local async_meths = n.async_meths
local test_build_dir = t.paths.test_build_dir
local nvim_prog = n.nvim_prog
local testprg = n.testprg
local exec = n.exec
@@ -2364,7 +2363,8 @@ describe('ui/msg_puts_printf', function()
skip(not t.translations_enabled(), 'Nvim not built with ENABLE_TRANSLATIONS')
local screen
local cmd = ''
local locale_dir = test_build_dir .. '/share/locale/ja/LC_MESSAGES'
local build_dir = t.paths.test_build_dir
local locale_dir = build_dir .. '/share/locale/ja/LC_MESSAGES'
clear({ env = { LANG = 'ja_JP.UTF-8' } })
screen = Screen.new(25, 5)
@@ -2383,10 +2383,11 @@ describe('ui/msg_puts_printf', function()
end
end
os.execute('cmake -E make_directory ' .. locale_dir)
os.execute(
'cmake -E copy ' .. test_build_dir .. '/src/nvim/po/ja.mo ' .. locale_dir .. '/nvim.mo'
)
fn.mkdir(locale_dir, 'p')
fn.filecopy(build_dir .. '/src/nvim/po/ja.mo', locale_dir .. '/nvim.mo')
finally(function()
n.rmdir(build_dir .. '/share')
end)
cmd = cmd .. '"' .. nvim_prog .. '" -u NONE -i NONE -Es -V1'
command([[call jobstart(']] .. cmd .. [[',{'term':v:true})]])
@@ -2397,8 +2398,6 @@ describe('ui/msg_puts_printf', function()
: |
|
]])
os.execute('cmake -E remove_directory ' .. test_build_dir .. '/share')
end)
end)