improve whitespace detection. resolves #452.
This commit is contained in:
parent
7857cc2345
commit
d99112d6c6
|
@ -36,19 +36,17 @@ function! airline#extensions#whitespace#check()
|
|||
|
||||
let mixed = 0
|
||||
if index(checks, 'indent') > -1
|
||||
let indents = [search('^ \{2,}', 'nb'), search('^ \{2,}', 'n'), search('^\t', 'nb'), search('^\t', 'n')]
|
||||
let mixed = indents[0] != 0 && indents[1] != 0 && indents[2] != 0 && indents[3] != 0
|
||||
let mixed = search('\v(^\t+ +)|(^ +\t+)', 'nw')
|
||||
endif
|
||||
|
||||
if trailing != 0 || mixed
|
||||
if trailing != 0 || mixed != 0
|
||||
let b:airline_whitespace_check = s:symbol
|
||||
if s:show_message
|
||||
if trailing != 0
|
||||
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing)
|
||||
endif
|
||||
if mixed
|
||||
let mixnr = indents[0] == indents[1] ? indents[0] : indents[2]
|
||||
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixnr)
|
||||
if mixed != 0
|
||||
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixed)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue