Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lua/neogit/buffers/commit_view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,15 @@ function M:open(kind)
end
end
vim.cmd("normal! zt")
else
-- Possibly in the header, scan down to the first hunk
local firstHunk = self.buffer.ui:find_component(function(c)
return c.options.tag == "Hunk"
end)
if firstHunk ~= nil then
local first, _ = firstHunk:row_range_abs()
self.buffer:move_cursor(first)
end
end
end,
[popups.mapping_for("BisectPopup")] = popups.open("bisect", function(p)
Expand Down
2 changes: 1 addition & 1 deletion lua/neogit/lib/ui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ end
---@param f fun(c: UiComponent): boolean
---@param options FindOptions|nil
function Ui:find_component(f, options)
return Ui._find_component(self.layout, f, options or {})
return Ui._find_component(self.layout.children, f, options or {})

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find_component seemed to be unused. It was not working because the layout doesn't have ipairs as _find_component expects. layout.children does.

end

---@param fn? fun(c: Component): boolean
Expand Down