Now trailing tabs are also reported, fixed bug when trailings with mixed tabs and spaces were being reported as mixed indents, case when count of spaces at the end of tabbed indentation less then tabstop does not reported as mixed indent anymore.

This commit is contained in:
Davit Samvelyan 2014-04-05 16:41:27 +05:00
parent a37f0b9ae0
commit 7b0d80050a

View File

@ -31,12 +31,18 @@ function! airline#extensions#whitespace#check()
let trailing = 0 let trailing = 0
if index(checks, 'trailing') > -1 if index(checks, 'trailing') > -1
let trailing = search(' $', 'nw') let trailing = search('\s$', 'nw')
endif endif
let mixed = 0 let mixed = 0
if index(checks, 'indent') > -1 if index(checks, 'indent') > -1
let mixed = search('\v(^\t+ +)|(^ +\t+)', 'nw') " [<tab>]<space><tab>
" Spaces before or between tabs are not allowed
let t_s_t = '(^\t* +\t\s*\S)'
" <tab>(<space> x count)
" Count of spaces at the end of tabs should be less then tabstop value
let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)'
let mixed = search('\v' . t_s_t . '|' . t_l_s, 'nw')
endif endif
if trailing != 0 || mixed != 0 if trailing != 0 || mixed != 0