Skip to content

Commit

Permalink
Merge pull request #55 from vim-jp/before-8.0
Browse files Browse the repository at this point in the history
prepare for 8.0 release
  • Loading branch information
koron authored Aug 31, 2016
2 parents ccc430c + 09dbfa9 commit 81a71ea
Show file tree
Hide file tree
Showing 4 changed files with 524 additions and 390 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion runtime/doc/vim.1
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ When N is omitted, open one tab page for each file.
\-R
Read-only mode.
The 'readonly' option will be set.
You can still edit the buffer, but will be prevented from accidently
You can still edit the buffer, but will be prevented from accidentally
overwriting a file.
If you do want to overwrite a file, add an exclamation mark to the Ex command,
as in ":w!".
Expand Down
76 changes: 55 additions & 21 deletions src/po/check.vim
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,66 @@ func! GetMline()
return substitute(idline, '[^%]*\(%[-+ #''.0-9*]*l\=[dsuxXpoc%]\)\=', '\1', 'g')
endfunc

" This only works when 'wrapscan' is set.
" This only works when 'wrapscan' is not set.
let s:save_wrapscan = &wrapscan
set wrapscan
set nowrapscan

" Start at the first "msgid" line.
1
/^msgid
let startline = line('.')
/^msgid\>

" When an error is detected this is set to the line number.
" Note: this is used in the Makefile.
let error = 0

while 1
if getline(line('.') - 1) !~ "no-c-format"
let fromline = GetMline()
" go over the "msgid" and "msgid_plural" lines
let prevfromline = 'foobar'
while 1
let fromline = GetMline()
if prevfromline != 'foobar' && prevfromline != fromline
echomsg 'Mismatching % in line ' . (line('.') - 1)
echomsg 'msgid: ' . prevfromline
echomsg 'msgid ' . fromline
if error == 0
let error = line('.')
endif
endif
if getline('.') !~ 'msgid_plural'
break
endif
let prevfromline = fromline
endwhile

if getline('.') !~ '^msgstr'
echo 'Missing "msgstr" in line ' . line('.')
let error = 1
endif
let toline = GetMline()
if fromline != toline
echo 'Mismatching % in line ' . (line('.') - 1)
echo 'msgid: ' . fromline
echo 'msgstr: ' . toline
let error = 1
echomsg 'Missing "msgstr" in line ' . line('.')
if error == 0
let error = line('.')
endif
endif

" check all the 'msgstr' lines
while getline('.') =~ '^msgstr'
let toline = GetMline()
if fromline != toline
echomsg 'Mismatching % in line ' . (line('.') - 1)
echomsg 'msgid: ' . fromline
echomsg 'msgstr: ' . toline
if error == 0
let error = line('.')
endif
endif
if line('.') == line('$')
break
endif
endwhile
endif

" Find next msgid.
" Wrap around at the end of the file, quit when back at the first one.
/^msgid
if line('.') == startline
" Find next msgid. Quit when there is no more.
let lnum = line('.')
silent! /^msgid\>
if line('.') == lnum
break
endif
endwhile
Expand All @@ -74,12 +104,16 @@ endwhile
"
1
if search('msgid "\("\n"\)\?\([EW][0-9]\+:\).*\nmsgstr "\("\n"\)\?[^"]\@=\2\@!') > 0
echo 'Mismatching error/warning code in line ' . line('.')
let error = 1
echomsg 'Mismatching error/warning code in line ' . line('.')
if error == 0
let error = line('.')
endif
endif

if error == 0
echo "OK"
echomsg "OK"
else
exe error
endif

let &wrapscan = s:save_wrapscan
Expand Down
Loading

0 comments on commit 81a71ea

Please sign in to comment.