mirror of
https://github.com/inkarkat/vim-ingo-library.git
synced 2026-06-10 15:37:43 +02:00
FIX: Must not :set readonly if no scratch contents
The previous split of ingo#buffer#generate#Create() subtly changed the behavior with empty scratch contents. We must not :setlocal readonly if the scratch buffer is still empty. Add a:isInitialized argument to ingo#buffer#scratch#SetLocal().
This commit is contained in:
@@ -64,13 +64,16 @@ function! ingo#buffer#scratch#Create( scratchDirspec, scratchFilename, scratchIs
|
||||
"*******************************************************************************
|
||||
let l:status = ingo#buffer#generate#Create(a:scratchDirspec, a:scratchFilename, a:scratchIsFile, a:scratchCommand, a:windowOpenCommand)
|
||||
if l:status != 0
|
||||
call ingo#buffer#scratch#SetLocal(a:scratchIsFile)
|
||||
call ingo#buffer#scratch#SetLocal(a:scratchIsFile, ! empty(a:scratchCommand))
|
||||
endif
|
||||
return l:status
|
||||
endfunction
|
||||
function! ingo#buffer#scratch#SetLocal( isFile )
|
||||
function! ingo#buffer#scratch#SetLocal( isFile, isInitialized )
|
||||
execute 'setlocal buftype=' . ingo#buffer#generate#BufType(a:isFile)
|
||||
setlocal bufhidden=wipe nobuflisted noswapfile readonly
|
||||
setlocal bufhidden=wipe nobuflisted noswapfile
|
||||
if a:isInitialized
|
||||
setlocal readonly
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax :
|
||||
|
||||
Reference in New Issue
Block a user