summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-03-11 19:44:51 +0000
committerw0rp <devw0rp@gmail.com>2019-03-11 19:44:51 +0000
commit365ffae6c4668f7aa89cc181e514bb6b2245c9a0 (patch)
tree593ad14cad229b0f1cbf8f6c8cebeb0017d6cbb1
parentf0da35b95807c4fa88ae3ccfaa14fbf4a7bd4d2c (diff)
downloadale-365ffae6c4668f7aa89cc181e514bb6b2245c9a0.zip
Fix #2351 - Escape spaces and backslashes for signs
-rw-r--r--autoload/ale/sign.vim15
1 files changed, 10 insertions, 5 deletions
diff --git a/autoload/ale/sign.vim b/autoload/ale/sign.vim
index fc1ea5b6..933fc055 100644
--- a/autoload/ale/sign.vim
+++ b/autoload/ale/sign.vim
@@ -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