summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-08-27 21:29:13 +0100
committerw0rp <devw0rp@gmail.com>2020-08-27 21:29:13 +0100
commitecd7abecc08ead5d8f055b26498e1c4a2a2c3065 (patch)
tree98cdae7df750d3236f2f318997ddc1a068aef44d
parent7545b18ba181be61bdeee09efa292e9e82b6e863 (diff)
downloadale-ecd7abecc08ead5d8f055b26498e1c4a2a2c3065.zip
Fix #3319 - Force modifications to buffers
-rw-r--r--autoload/ale/util.vim11
1 files changed, 11 insertions, 0 deletions
diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim
index 1f396377..05f11993 100644
--- a/autoload/ale/util.vim
+++ b/autoload/ale/util.vim
@@ -505,6 +505,13 @@ function! ale#util#SetBufferContents(buffer, lines) abort
\ : a:lines
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.
if l:has_bufline_api
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)
endif
+ if !l:modifiable
+ call setbufvar(a:buffer, '&modifiable', 0)
+ endif
+
return l:new_lines
endfunction