From 365ffae6c4668f7aa89cc181e514bb6b2245c9a0 Mon Sep 17 00:00:00 2001 From: w0rp Date: Mon, 11 Mar 2019 19:44:51 +0000 Subject: [PATCH] Fix #2351 - Escape spaces and backslashes for signs --- autoload/ale/sign.vim | 15 ++++++++++----- 1 file 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