fix: change readonly files (#1659)

This commit is contained in:
yetone
2025-03-21 19:48:28 +08:00
committed by GitHub
parent bae5275705
commit a60a8d4701
2 changed files with 4 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ function M:new(message, callback, opts)
local this = setmetatable({}, M)
this.message = message
this.callback = callback
this._container_winid = opts.container_winid
this._container_winid = opts.container_winid or vim.api.nvim_get_current_win()
this._focus = opts.focus
return this
end
@@ -81,7 +81,7 @@ function M:open()
text = { top = NuiText(" Confirmation ", Highlights.CONFIRM_TITLE) },
},
buf_options = {
filetype = "avante-confirm",
filetype = "AvanteConfirm",
modifiable = false,
readonly = true,
},

View File

@@ -455,12 +455,14 @@ function M.get_winid(bufnr)
end
function M.unlock_buf(bufnr)
vim.bo[bufnr].readonly = false
vim.bo[bufnr].modified = false
vim.bo[bufnr].modifiable = true
end
function M.lock_buf(bufnr)
vim.cmd("stopinsert")
vim.bo[bufnr].readonly = true
vim.bo[bufnr].modified = false
vim.bo[bufnr].modifiable = false
end