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
|
let mixed = 0
|
||||||
if index(checks, 'indent') > -1
|
if index(checks, 'indent') > -1
|
||||||
let indents = [search('^ \{2,}', 'nb'), search('^ \{2,}', 'n'), search('^\t', 'nb'), search('^\t', 'n')]
|
let mixed = search('\v(^\t+ +)|(^ +\t+)', 'nw')
|
||||||
let mixed = indents[0] != 0 && indents[1] != 0 && indents[2] != 0 && indents[3] != 0
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if trailing != 0 || mixed
|
if trailing != 0 || mixed != 0
|
||||||
let b:airline_whitespace_check = s:symbol
|
let b:airline_whitespace_check = s:symbol
|
||||||
if s:show_message
|
if s:show_message
|
||||||
if trailing != 0
|
if trailing != 0
|
||||||
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing)
|
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing)
|
||||||
endif
|
endif
|
||||||
if mixed
|
if mixed != 0
|
||||||
let mixnr = indents[0] == indents[1] ? indents[0] : indents[2]
|
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixed)
|
||||||
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixnr)
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user