fix(git): preserve dispatch and content after jumping back

This commit is contained in:
2026-05-08 01:46:43 +02:00
parent 4649b803ab
commit 867b5c2a2e
4 changed files with 78 additions and 12 deletions
+5 -8
View File
@@ -47,14 +47,13 @@ local function fetch(worktree, max_count)
return util.exec(cmd, { cwd = worktree })
end
---@type table<string, integer> -- worktree -> max_count
local max_counts = {}
---@param buf integer
---@param r ow.Git.Repo
local function populate(buf, r)
local state = r:state(buf)
if not state then
return
end
local stdout = fetch(r.worktree, state.log_max_count)
local stdout = fetch(r.worktree, max_counts[r.worktree])
if not stdout then
return
end
@@ -123,10 +122,8 @@ function M.open(opts)
return
end
max_counts[r.worktree] = opts.max_count
local buf = vim.fn.bufadd(M.URI_PREFIX .. r.worktree)
repo.bind(buf, r)
local state = r:state(buf) --[[@as -nil]]
state.log_max_count = opts.max_count
local was_loaded = vim.api.nvim_buf_is_loaded(buf)
local win = vim.fn.bufwinid(buf)