summaryrefslogtreecommitdiff
path: root/autoload/ale/util.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/ale/util.vim')
-rw-r--r--autoload/ale/util.vim13
1 files changed, 12 insertions, 1 deletions
diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim
index 2dc71ce5..98af1635 100644
--- a/autoload/ale/util.vim
+++ b/autoload/ale/util.vim
@@ -522,7 +522,18 @@ function! ale#util#SetBufferContents(buffer, lines) abort
" Use a Vim API for setting lines in other buffers, if available.
if l:has_bufline_api
- call setbufline(a:buffer, 1, l:new_lines)
+ if has('nvim')
+ " save and restore signs to avoid flickering
+ let signs = sign_getplaced(a:buffer, {'group': 'ale'})[0].signs
+
+ call nvim_buf_set_lines(a:buffer, 0, l:first_line_to_remove, 0, l:new_lines)
+
+ " restore signs (invalid line numbers will be skipped)
+ call sign_placelist(map(signs, {_, v -> extend(v, {'buffer': a:buffer})}))
+ else
+ call setbufline(a:buffer, 1, l:new_lines)
+ endif
+
call deletebufline(a:buffer, l:first_line_to_remove, '$')
" Fall back on setting lines the old way, for the current buffer.
else