mirror of
https://github.com/vim/vim.git
synced 2025-10-25 09:04:09 -04:00
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: #17597
Signed-off-by: Emir SARI <emir_sari@icloud.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
468c62e4fd
commit
8fe9e55a7d
@@ -5411,9 +5411,11 @@ get_rel_pos(
|
|||||||
return (int)vim_snprintf_safelen((char *)buf, buflen,
|
return (int)vim_snprintf_safelen((char *)buf, buflen,
|
||||||
"%s", _("Top"));
|
"%s", _("Top"));
|
||||||
|
|
||||||
|
int perc = calc_percentage(above, above + below);
|
||||||
|
char tmp[8];
|
||||||
// localized percentage value
|
// localized percentage value
|
||||||
return (int)vim_snprintf_safelen((char *)buf, buflen,
|
vim_snprintf(tmp, sizeof(tmp), _("%d%%"), perc);
|
||||||
_("%2d%%"), calc_percentage(above, above + below));
|
return (int)vim_snprintf_safelen((char *)buf, buflen, _("%2s"), tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -4377,4 +4377,30 @@ func Test_scroll_longline_winwidth()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_pos_percentage_in_turkish_locale()
|
||||||
|
throw 'Skipped: FIXME: please remove throw when Turkish locale has been updated!'
|
||||||
|
CheckRunVimInTerminal
|
||||||
|
defer execute(':lang C')
|
||||||
|
|
||||||
|
try
|
||||||
|
let dir = expand('$VIMRUNTIME/lang/tr/')
|
||||||
|
let target = expand('$VIMRUNTIME/lang/tr/LC_MESSAGES/')
|
||||||
|
let tr = '../po/tr.mo'
|
||||||
|
call mkdir(dir, 'R')
|
||||||
|
call mkdir(target, '')
|
||||||
|
call filecopy(tr, target .. 'vim.mo')
|
||||||
|
lang tr_TR.UTF-8
|
||||||
|
let buf = RunVimInTerminal('', {'rows': 5})
|
||||||
|
call term_sendkeys(buf, ":lang tr_TR.UTF-8\<cr>")
|
||||||
|
call term_sendkeys(buf, ":put =range(1,40)\<cr>")
|
||||||
|
call term_sendkeys(buf, ":5\<cr>")
|
||||||
|
call WaitForAssert({-> assert_match('%8$', term_getline(buf, 5))})
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
catch /E197:/
|
||||||
|
" can't use Turkish locale
|
||||||
|
throw 'Skipped: Turkish locale not available'
|
||||||
|
endtry
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
|
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
|
||||||
|
|||||||
@@ -709,6 +709,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1479,
|
||||||
/**/
|
/**/
|
||||||
1478,
|
1478,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user