From da331acc9e1662e61fb7b829a3f928530fc8e52b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Gro=C3=9F?= <21310755+vimpostor@users.noreply.github.com> Date: Sun, 24 Oct 2021 04:35:06 +0200 Subject: 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 --- autoload/ale/virtualtext.vim | 5 +++-- 1 file 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]], -- cgit v1.2.3