mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.0.1497: the ruler percentage can't be localized
Problem: The ruler percentage can't be localized. Solution: Use a string that can be translated. (Emir Sari, closes #12311)
This commit is contained in:
committed by
Bram Moolenaar
parent
0b933c331d
commit
971cd2b8bc
22
src/buffer.c
22
src/buffer.c
@@ -5231,8 +5231,8 @@ build_stl_str_hl(
|
||||
#endif // FEAT_STL_OPT
|
||||
|
||||
/*
|
||||
* Get relative cursor position in window into "buf[buflen]", in the form 99%,
|
||||
* using "Top", "Bot" or "All" when appropriate.
|
||||
* Get relative cursor position in window into "buf[buflen]", in the localized
|
||||
* percentage form like %99, 99%; using "Top", "Bot" or "All" when appropriate.
|
||||
*/
|
||||
void
|
||||
get_rel_pos(
|
||||
@@ -5260,9 +5260,23 @@ get_rel_pos(
|
||||
else if (above <= 0)
|
||||
vim_strncpy(buf, (char_u *)_("Top"), (size_t)(buflen - 1));
|
||||
else
|
||||
vim_snprintf((char *)buf, (size_t)buflen, "%2d%%", above > 1000000L
|
||||
{
|
||||
int perc = (above > 1000000L)
|
||||
? (int)(above / ((above + below) / 100L))
|
||||
: (int)(above * 100L / (above + below)));
|
||||
: (int)(above * 100L / (above + below));
|
||||
|
||||
char *p = (char *)buf;
|
||||
size_t l = buflen;
|
||||
if (perc < 10)
|
||||
{
|
||||
// prepend one space
|
||||
buf[0] = ' ';
|
||||
++p;
|
||||
--l;
|
||||
}
|
||||
// localized percentage value
|
||||
vim_snprintf(p, l, _("%d%%"), perc);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1497,
|
||||
/**/
|
||||
1496,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user