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

@@ -131,4 +131,33 @@ describe('normal', function()
feed('jg^k')
eq(3, fn.virtcol('.'))
end)
-- oldtest: Test_pos_percentage_in_turkish_locale()
it('viewport position percentage in Turkish locale', function()
t.skip(not t.translations_enabled(), 'Nvim not built with ENABLE_TRANSLATIONS')
t.skip(not pcall(exec, 'lang tr_TR.UTF-8'), 'Turkish locale not available')
local build_dir = t.paths.test_build_dir
local locale_dir = build_dir .. '/share/locale/tr/LC_MESSAGES'
fn.mkdir(locale_dir, 'p')
fn.filecopy(build_dir .. '/src/nvim/po/tr.mo', locale_dir .. '/nvim.mo')
finally(function()
n.rmdir(build_dir .. '/share')
end)
clear({ env = { LANG = 'tr_TR.UTF-8' } })
screen = Screen.new(75, 5)
exec('set ruler')
exec('lang tr_TR.UTF-8')
exec('put =range(1,40)')
exec('5')
screen:expect([[
3 |
^4 |
5 |
6 |
40 more lines 5,1 %8 |
]])
end)
end)