refactor(git): hardcode strict_indexing in set_buf_lines

This commit is contained in:
2026-05-06 15:47:26 +02:00
parent 6fdd455536
commit e00a282194
5 changed files with 6 additions and 8 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ local function run_in_split(r, args, conf)
end end
end end
vim.bo[buf].filetype = conf.ft vim.bo[buf].filetype = conf.ft
util.buf_set_lines(buf, 0, -1, false, util.split_lines(stdout)) util.set_buf_lines(buf, 0, -1, util.split_lines(stdout))
end, end,
}) })
end end
+1 -2
View File
@@ -76,11 +76,10 @@ local function populate(buf, r)
for i = #hunks, 1, -1 do for i = #hunks, 1, -1 do
local sa, ca, sb, cb = unpack(hunks[i]) local sa, ca, sb, cb = unpack(hunks[i])
local start = ca == 0 and sa or sa - 1 local start = ca == 0 and sa or sa - 1
util.buf_set_lines( util.set_buf_lines(
buf, buf,
start, start,
start + ca, start + ca,
false,
vim.list_slice(new_lines, sb, sb + cb - 1) vim.list_slice(new_lines, sb, sb + cb - 1)
) )
end end
+1 -1
View File
@@ -199,7 +199,7 @@ local function populate(buf, r, rev, state, rev_sha)
end end
end end
util.buf_set_lines(buf, 0, -1, false, util.split_lines(stdout)) util.set_buf_lines(buf, 0, -1, util.split_lines(stdout))
state.sha = rev_sha state.sha = rev_sha
return true return true
end end
+1 -1
View File
@@ -132,7 +132,7 @@ local function render(bufnr, status)
end end
end end
util.buf_set_lines(bufnr, 0, -1, false, lines) util.set_buf_lines(bufnr, 0, -1, lines)
vim.api.nvim_buf_clear_namespace(bufnr, ns, 0, -1) vim.api.nvim_buf_clear_namespace(bufnr, ns, 0, -1)
for _, m in ipairs(marks) do for _, m in ipairs(marks) do
vim.api.nvim_buf_set_extmark(bufnr, ns, m.row, m.col, { vim.api.nvim_buf_set_extmark(bufnr, ns, m.row, m.col, {
+2 -3
View File
@@ -83,12 +83,11 @@ end
---@param buf integer ---@param buf integer
---@param start integer ---@param start integer
---@param end_ integer ---@param end_ integer
---@param strict_indexing boolean
---@param lines string[] ---@param lines string[]
function M.buf_set_lines(buf, start, end_, strict_indexing, lines) function M.set_buf_lines(buf, start, end_, lines)
local was_modifiable = vim.bo[buf].modifiable local was_modifiable = vim.bo[buf].modifiable
vim.bo[buf].modifiable = true vim.bo[buf].modifiable = true
vim.api.nvim_buf_set_lines(buf, start, end_, strict_indexing, lines) vim.api.nvim_buf_set_lines(buf, start, end_, true, lines)
vim.bo[buf].modifiable = was_modifiable vim.bo[buf].modifiable = was_modifiable
vim.bo[buf].modified = false vim.bo[buf].modified = false
end end