mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-25 19:17:23 +08:00
Fix #3319 - Force modifications to buffers
This commit is contained in:
@@ -505,6 +505,13 @@ function! ale#util#SetBufferContents(buffer, lines) abort
|
|||||||
\ : a:lines
|
\ : a:lines
|
||||||
let l:first_line_to_remove = len(l:new_lines) + 1
|
let l:first_line_to_remove = len(l:new_lines) + 1
|
||||||
|
|
||||||
|
" We'll temporarily make a buffer modifiable, to force edits.
|
||||||
|
let l:modifiable = getbufvar(a:buffer, '&modifiable')
|
||||||
|
|
||||||
|
if !l:modifiable
|
||||||
|
call setbufvar(a:buffer, '&modifiable', 1)
|
||||||
|
endif
|
||||||
|
|
||||||
" Use a Vim API for setting lines in other buffers, if available.
|
" Use a Vim API for setting lines in other buffers, if available.
|
||||||
if l:has_bufline_api
|
if l:has_bufline_api
|
||||||
call setbufline(a:buffer, 1, l:new_lines)
|
call setbufline(a:buffer, 1, l:new_lines)
|
||||||
@@ -523,5 +530,9 @@ function! ale#util#SetBufferContents(buffer, lines) abort
|
|||||||
call setline(1, l:new_lines)
|
call setline(1, l:new_lines)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !l:modifiable
|
||||||
|
call setbufvar(a:buffer, '&modifiable', 0)
|
||||||
|
endif
|
||||||
|
|
||||||
return l:new_lines
|
return l:new_lines
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user