Skip to content

Commit

Permalink
fix: try fix modifiable error
Browse files Browse the repository at this point in the history
  • Loading branch information
weirongxu committed May 9, 2022
1 parent d56b05d commit 3992e5d
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions autoload/coc_explorer/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,25 @@ function! coc_explorer#util#buf_set_lines_skip_cursor(bufnr, start, end, strict_
call setbufvar(a:bufnr, '&modifiable', 1)
call setbufvar(a:bufnr, '&readonly', 0)

if s:is_nvim
let cursor = v:null
let winid = bufwinid(a:bufnr)
if winid >= 0
let cursor = nvim_win_get_cursor(winid)
try
if s:is_nvim
let cursor = v:null
let winid = bufwinid(a:bufnr)
if winid >= 0
let cursor = nvim_win_get_cursor(winid)
endif
call nvim_buf_set_lines(a:bufnr, a:start, a:end, a:strict_indexing, a:lines)
if winid >= 0
try
call nvim_win_set_cursor(winid, cursor)
catch
endtry
endif
else
call coc#api#call('buf_set_lines', [a:bufnr, a:start, a:end, a:strict_indexing, a:lines])
endif
call nvim_buf_set_lines(a:bufnr, a:start, a:end, a:strict_indexing, a:lines)
if winid >= 0
try
call nvim_win_set_cursor(winid, cursor)
catch
endtry
endif
else
call coc#api#call('buf_set_lines', [a:bufnr, a:start, a:end, a:strict_indexing, a:lines])
endif
catch
endtry

call setbufvar(a:bufnr, '&readonly', 1)
call setbufvar(a:bufnr, '&modifiable', 0)
Expand Down

0 comments on commit 3992e5d

Please sign in to comment.