refactor(git): generalize buf_set_lines wrapper
This commit is contained in:
@@ -73,11 +73,10 @@ local function populate(buf, r)
|
||||
if #hunks == 0 then
|
||||
return
|
||||
end
|
||||
vim.bo[buf].modifiable = true
|
||||
for i = #hunks, 1, -1 do
|
||||
local sa, ca, sb, cb = unpack(hunks[i])
|
||||
local start = ca == 0 and sa or sa - 1
|
||||
vim.api.nvim_buf_set_lines(
|
||||
util.buf_set_lines(
|
||||
buf,
|
||||
start,
|
||||
start + ca,
|
||||
@@ -85,8 +84,6 @@ local function populate(buf, r)
|
||||
vim.list_slice(new_lines, sb, sb + cb - 1)
|
||||
)
|
||||
end
|
||||
vim.bo[buf].modifiable = false
|
||||
vim.bo[buf].modified = false
|
||||
end
|
||||
|
||||
---@param buf integer
|
||||
@@ -105,6 +102,7 @@ function M.read_uri(buf)
|
||||
vim.bo[buf].swapfile = false
|
||||
vim.bo[buf].bufhidden = "hide"
|
||||
vim.bo[buf].buftype = "nofile"
|
||||
vim.bo[buf].modifiable = false
|
||||
if vim.bo[buf].filetype ~= "gitlog" then
|
||||
vim.bo[buf].filetype = "gitlog"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user