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
This commit is contained in:
Magnus Groß 2021-10-24 04:35:06 +02:00 committed by GitHub
parent 95ba7898b4
commit da331acc9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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]],