mirror of
https://github.com/neovim/neovim.git
synced 2025-11-16 15:21:20 +00:00
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:
@@ -3478,9 +3478,11 @@ int get_rel_pos(win_T *wp, char *buf, int buflen)
|
||||
"%s", _("Top"));
|
||||
}
|
||||
|
||||
int perc = calc_percentage(above, above + below);
|
||||
char tmp[8];
|
||||
// localized percentage value
|
||||
return (int)vim_snprintf_safelen(buf, (size_t)buflen,
|
||||
_("%2d%%"), calc_percentage(above, above + below));
|
||||
vim_snprintf(tmp, sizeof(tmp), _("%d%%"), perc);
|
||||
return (int)vim_snprintf_safelen(buf, (size_t)buflen, _("%2s"), tmp);
|
||||
}
|
||||
|
||||
/// Append (2 of 8) to "buf[]", if editing more than one file.
|
||||
|
||||
Reference in New Issue
Block a user