Skip to content

Commit 3cf1095

Browse files
authored
Merge pull request #439 from ichizok/cleanup-tmpbuf
Vim.Buffer: Cleanup tempfile buffer in read_content()
2 parents 1fceb56 + d82b8d8 commit 3cf1095

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

autoload/vital/__vital__/Vim/Buffer.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ function! s:read_content(content, ...) abort
118118
\)
119119
finally
120120
call delete(tempfile)
121+
execute 'bwipeout!' tempfile
121122
endtry
122123
endfunction
123124

test/Vim/Buffer.vimspec

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ Describe Vim.Buffer
179179
Assert Equals(&fileencoding, 'utf-8')
180180
End
181181
End
182+
It wipes out tempfile buffer
183+
let fname = tempname()
184+
call Buffer.read_content([''], {'tempfile': fname})
185+
Assert Equals(bufnr(fname), -1)
186+
End
182187
End
183188

184189
Describe edit_content()

0 commit comments

Comments
 (0)