patch 8.0.0794: checking translations fails with multiple NL
Problem: The script to check translations fails if there is more than one
NL in one line.
Solution: Count the number of NL characters. Make count() accept a string.
diff --git a/src/po/check.vim b/src/po/check.vim
index ba98ae7..3bcbef3 100644
--- a/src/po/check.vim
+++ b/src/po/check.vim
@@ -114,14 +114,12 @@
func! CountNl(first, last)
let nl = 0
for lnum in range(a:first, a:last)
- if getline(lnum) =~ '\\n'
- let nl += 1
- endif
+ let nl += count(getline(lnum), "\n")
endfor
return nl
endfunc
-" Check that the \n at the end of the msid line is also present in the msgstr
+" Check that the \n at the end of the msgid line is also present in the msgstr
" line. Skip over the header.
/^"MIME-Version:
while 1
@@ -138,7 +136,7 @@
let transcount = CountNl(strlnum, end - 1)
" Allow for a few more or less line breaks when there are 2 or more
if origcount != transcount && (origcount <= 2 || transcount <= 2)
- echomsg 'Mismatching "\\n" in line ' . line('.')
+ echomsg 'Mismatching "\n" in line ' . line('.')
if error == 0
let error = lnum
endif