Fix #2351 - Escape spaces and backslashes for signs

This commit is contained in:
w0rp 2019-03-11 19:44:51 +00:00
parent f0da35b958
commit 365ffae6c4
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83
1 changed files with 10 additions and 5 deletions

View File

@ -64,16 +64,21 @@ if !hlexists('ALESignColumnWithoutErrors')
call ale#sign#SetUpDefaultColumnWithoutErrorsHighlight()
endif
" Spaces and backslashes need to be escaped for signs.
function! s:EscapeSignText(sign_text) abort
return substitute(a:sign_text, '\\\| ', '\\\0', 'g')
endfunction
" Signs show up on the left for error markers.
execute 'sign define ALEErrorSign text=' . g:ale_sign_error
execute 'sign define ALEErrorSign text=' . s:EscapeSignText(g:ale_sign_error)
\ . ' texthl=ALEErrorSign linehl=ALEErrorLine'
execute 'sign define ALEStyleErrorSign text=' . g:ale_sign_style_error
execute 'sign define ALEStyleErrorSign text=' . s:EscapeSignText(g:ale_sign_style_error)
\ . ' texthl=ALEStyleErrorSign linehl=ALEErrorLine'
execute 'sign define ALEWarningSign text=' . g:ale_sign_warning
execute 'sign define ALEWarningSign text=' . s:EscapeSignText(g:ale_sign_warning)
\ . ' texthl=ALEWarningSign linehl=ALEWarningLine'
execute 'sign define ALEStyleWarningSign text=' . g:ale_sign_style_warning
execute 'sign define ALEStyleWarningSign text=' . s:EscapeSignText(g:ale_sign_style_warning)
\ . ' texthl=ALEStyleWarningSign linehl=ALEWarningLine'
execute 'sign define ALEInfoSign text=' . g:ale_sign_info
execute 'sign define ALEInfoSign text=' . s:EscapeSignText(g:ale_sign_info)
\ . ' texthl=ALEInfoSign linehl=ALEInfoLine'
sign define ALEDummySign