summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Groß <21310755+vimpostor@users.noreply.github.com>2021-10-24 04:35:06 +0200
committerGitHub <noreply@github.com>2021-10-24 11:35:06 +0900
commitda331acc9e1662e61fb7b829a3f928530fc8e52b (patch)
treeda2e0ab15e5fa6f883a87ae34035f7778f1b7d2c
parent95ba7898b45c3cbac77463aace447ead4e173556 (diff)
downloadale-da331acc9e1662e61fb7b829a3f928530fc8e52b.zip
Replace line breaks in virtual text with whitespace (#3949)
Before this patch multiline warnings would appear in a single line with '^@' as separator. Now we use whitespace as separator to improve the appearance. Also strip trailing whitespace, newlines, etc... Fixes #3939
-rw-r--r--autoload/ale/virtualtext.vim5
1 files changed, 3 insertions, 2 deletions
diff --git a/autoload/ale/virtualtext.vim b/autoload/ale/virtualtext.vim
index 2a9903bc..598bc1bf 100644
--- a/autoload/ale/virtualtext.vim
+++ b/autoload/ale/virtualtext.vim
@@ -64,15 +64,16 @@ function! ale#virtualtext#ShowMessage(message, hl_group) abort
let l:line = line('.')
let l:buffer = bufnr('')
let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ')
+ let l:msg = l:prefix.trim(substitute(a:message, '\n', ' ', 'g'))
if has('nvim')
- call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:prefix.a:message, a:hl_group]], {})
+ call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:msg, a:hl_group]], {})
else
let l:left_pad = col('$')
call prop_add(l:line, l:left_pad, {
\ 'type': 'ale',
\})
- let s:last_popup = popup_create(l:prefix.a:message, {
+ let s:last_popup = popup_create(l:msg, {
\ 'line': -1,
\ 'padding': [0, 0, 0, 1],
\ 'mask': [[1, 1, 1, 1]],