diff options
author | Christ van Willegen <cvwillegen@gmail.com> | 2023-08-13 18:03:14 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-08-13 18:06:00 +0200 |
commit | 0c6181fec4c362eb9682d5af583341eb20cb1af5 (patch) | |
tree | e28ab76bd05d019ae45dee9286ab32f827513cc4 /src/po | |
parent | 1688938dd5ac78ab67e54299b9d5b93499dba762 (diff) |
patch 9.0.1704: Cannot use positional arguments for printf()v9.0.1704
Problem: Cannot use positional arguments for printf()
Solution: Support positional arguments in string formatting
closes: #12140
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
Diffstat (limited to 'src/po')
-rw-r--r-- | src/po/check.vim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/po/check.vim b/src/po/check.vim index b2a5fd582e..917c648494 100644 --- a/src/po/check.vim +++ b/src/po/check.vim @@ -30,8 +30,15 @@ func! GetMline() " remove '%' used for plural forms. let idline = substitute(idline, '\\nPlural-Forms: .\+;\\n', '', '') + " remove duplicate positional format arguments + let idline2 = "" + while idline2 != idline + let idline2 = idline + let idline = substitute(idline, '%\([1-9][0-9]*\)\$\([-+ #''.*]*[0-9]*l\=[dsuxXpoc%]\)\(.*\)%\1$\([-+ #''.*]*\)\(l\=[dsuxXpoc%]\)', '%\1$\2\3\4', 'g') + endwhile + " remove everything but % items. - return substitute(idline, '[^%]*\(%[-+ #''.0-9*]*l\=[dsuxXpoc%]\)\=', '\1', 'g') + return substitute(idline, '[^%]*\(%([1-9][0-9]*\$)\=[-+ #''.0-9*]*l\=[dsuxXpoc%]\)\=', '\1', 'g') endfunc " This only works when 'wrapscan' is not set. |