From 0c6181fec4c362eb9682d5af583341eb20cb1af5 Mon Sep 17 00:00:00 2001 From: Christ van Willegen Date: Sun, 13 Aug 2023 18:03:14 +0200 Subject: patch 9.0.1704: Cannot use positional arguments for printf() Problem: Cannot use positional arguments for printf() Solution: Support positional arguments in string formatting closes: #12140 Signed-off-by: Christian Brabandt Co-authored-by: Christ van Willegen --- src/po/check.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/po') 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. -- cgit v1.2.3