Skip to content

Commit

Permalink
Refactor buffer handling functions to use silent call before `delet…
Browse files Browse the repository at this point in the history
…ebufline` to prevent error messages from showing up.
  • Loading branch information
skywind3000 committed Mar 21, 2024
1 parent 60ee57e commit cc254b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions autoload/quickui/core.vim
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ function! quickui#core#buffer_alloc()
endif
endif
call setbufvar(bid, '&modifiable', 1)
call deletebufline(bid, 1, '$')
silent call deletebufline(bid, 1, '$')
call setbufvar(bid, '&modified', 0)
call setbufvar(bid, '&filetype', '')
return bid
Expand All @@ -429,7 +429,7 @@ function! quickui#core#buffer_free(bid)
let index = len(s:buffer_array)
let s:buffer_array[index] = a:bid
call setbufvar(a:bid, '&modifiable', 1)
call deletebufline(a:bid, 1, '$')
silent call deletebufline(a:bid, 1, '$')
call setbufvar(a:bid, '&modified', 0)
endfunc

Expand All @@ -444,7 +444,7 @@ function! quickui#core#buffer_update(bid, textlist)
let textlist = split('' . a:textlist, '\n', 1)
endif
call setbufvar(a:bid, '&modifiable', 1)
call deletebufline(a:bid, 1, '$')
silent call deletebufline(a:bid, 1, '$')
call setbufline(a:bid, 1, textlist)
call setbufvar(a:bid, '&modified', 0)
endfunc
Expand Down

0 comments on commit cc254b5

Please sign in to comment.