refactor(git): generalize buf_set_lines wrapper
This commit is contained in:
+5
-2
@@ -81,11 +81,14 @@ function M.debug(fmt, ...)
|
||||
end
|
||||
|
||||
---@param buf integer
|
||||
---@param start integer
|
||||
---@param end_ integer
|
||||
---@param strict_indexing boolean
|
||||
---@param lines string[]
|
||||
function M.replace_buf_lines(buf, lines)
|
||||
function M.buf_set_lines(buf, start, end_, strict_indexing, lines)
|
||||
local was_modifiable = vim.bo[buf].modifiable
|
||||
vim.bo[buf].modifiable = true
|
||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines)
|
||||
vim.api.nvim_buf_set_lines(buf, start, end_, strict_indexing, lines)
|
||||
vim.bo[buf].modifiable = was_modifiable
|
||||
vim.bo[buf].modified = false
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user