Skip to content

Commit

Permalink
Merge pull request #148 from vim-jp/update-for-9.0.1222
Browse files Browse the repository at this point in the history
Update for 9.0.1222
  • Loading branch information
k-takata committed Jun 5, 2023
2 parents 7380404 + 56b5b6e commit 1dc3df1
Show file tree
Hide file tree
Showing 2 changed files with 384 additions and 169 deletions.
12 changes: 11 additions & 1 deletion src/po/check.vim
Expand Up @@ -6,6 +6,9 @@

if 1 " Only execute this if the eval feature is available.

" using line continuation
set cpo&vim

" Function to get a split line at the cursor.
" Used for both msgid and msgstr lines.
" Removes all text except % items and returns the result.
Expand Down Expand Up @@ -59,12 +62,18 @@ while 1
if getline(line('.') - 1) !~ "no-c-format"
" go over the "msgid" and "msgid_plural" lines
let prevfromline = 'foobar'
let plural = 0
while 1
if getline('.') =~ 'msgid_plural'
let plural += 1
endif
let fromline = GetMline()
if prevfromline != 'foobar' && prevfromline != fromline
\ && (plural != 1
\ || count(prevfromline, '%') + 1 != count(fromline, '%'))
echomsg 'Mismatching % in line ' . (line('.') - 1)
echomsg 'msgid: ' . prevfromline
echomsg 'msgid ' . fromline
echomsg 'msgid: ' . fromline
if error == 0
let error = line('.')
endif
Expand All @@ -86,6 +95,7 @@ while 1
while getline('.') =~ '^msgstr'
let toline = GetMline()
if fromline != toline
\ && (plural == 0 || count(fromline, '%') != count(toline, '%') + 1)
echomsg 'Mismatching % in line ' . (line('.') - 1)
echomsg 'msgid: ' . fromline
echomsg 'msgstr: ' . toline
Expand Down

0 comments on commit 1dc3df1

Please sign in to comment.