Minor bug fix: string length calculations.

This commit is contained in:
LCD 47 2014-01-09 20:06:55 +02:00
parent 86e8b63154
commit f1aae5c5cc
4 changed files with 6 additions and 9 deletions

View File

@ -117,7 +117,7 @@ function! syntastic#util#wideMsg(msg)
"convert tabs to spaces so that the tabs count towards the window "convert tabs to spaces so that the tabs count towards the window
"width as the proper amount of characters "width as the proper amount of characters
let chunks = split(msg, "\t", 1) let chunks = split(msg, "\t", 1)
let msg = join(map(chunks[:-2], 'v:val . repeat(" ", &ts - len(v:val) % &ts)'), '') . chunks[-1] let msg = join(map(chunks[:-2], 'v:val . repeat(" ", &ts - strwidth(v:val) % &ts)'), '') . chunks[-1]
let msg = strpart(msg, 0, winwidth(0) - 1) let msg = strpart(msg, 0, winwidth(0) - 1)
set noruler noshowcmd set noruler noshowcmd

View File

@ -21,7 +21,7 @@ set cpo&vim
function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
let result = '' let result = ''
let near = matchstr(a:pos['text'], '\mnear ''\zs[^'']\+\ze''') let near = matchstr(a:pos['text'], '\mnear ''\zs[^'']\+\ze''')
if len(near) > 0 if strlen(near) > 0
if near ==# '<eof>' if near ==# '<eof>'
let p = getpos('$') let p = getpos('$')
let a:pos['lnum'] = p[1] let a:pos['lnum'] = p[1]
@ -35,7 +35,7 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
" in future versions of syntastic; enable it at your own risk :) " in future versions of syntastic; enable it at your own risk :)
"let open = matchstr(a:pos['text'], '\m(to close ''\zs[^'']\+\ze'' at line [0-9]\+)') "let open = matchstr(a:pos['text'], '\m(to close ''\zs[^'']\+\ze'' at line [0-9]\+)')
"if len(open) > 0 "if strlen(open) > 0
" let line = str2nr(matchstr(a:pos['text'], '\m(to close ''[^'']\+'' at line \zs[0-9]\+\ze)')) " let line = str2nr(matchstr(a:pos['text'], '\m(to close ''[^'']\+'' at line \zs[0-9]\+\ze)'))
" let group = a:pos['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning' " let group = a:pos['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning'
" call matchadd(group, '\%' . line . 'l\V' . open) " call matchadd(group, '\%' . line . 'l\V' . open)

View File

@ -19,11 +19,8 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_php_php_GetHighlightRegex(item) function! SyntaxCheckers_php_php_GetHighlightRegex(item)
let unexpected = matchstr(a:item['text'], "\\munexpected '[^']\\+'") let term = matchstr(a:item['text'], "\\munexpected '\\zs[^']\\+\\ze'")
if len(unexpected) < 1 return term != '' ? '\V' . term : ''
return ''
endif
return '\V'.split(unexpected, "'")[1]
endfunction endfunction
function! SyntaxCheckers_php_php_GetLocList() dict function! SyntaxCheckers_php_php_GetLocList() dict

View File

@ -22,7 +22,7 @@ function! s:GetShell()
if !exists('b:shell') || b:shell == '' if !exists('b:shell') || b:shell == ''
let b:shell = '' let b:shell = ''
let shebang = getbufline(bufnr('%'), 1)[0] let shebang = getbufline(bufnr('%'), 1)[0]
if len(shebang) > 0 if strlen(shebang) > 0
if stridx(shebang, 'bash') >= 0 if stridx(shebang, 'bash') >= 0
let b:shell = 'bash' let b:shell = 'bash'
elseif stridx(shebang, 'zsh') >= 0 elseif stridx(shebang, 'zsh') >= 0