Skip to content

Commit

Permalink
chore: revert find_component limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ten3roberts committed Aug 11, 2023
1 parent c880990 commit ec1faca
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lua/neogit/buffers/commit_select_view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function M:open(action)
if win and item and item.commit then
local found = buffer.ui:find_component(function(c)
return c.options.oid == item.commit.oid
end, { limit = 256 })
end)

if found then
vim.api.nvim_win_set_cursor(win, { found.position.row_start, 0 })
Expand Down
2 changes: 1 addition & 1 deletion lua/neogit/buffers/log_view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function M:open()
if win and item and item.commit then
local found = buffer.ui:find_component(function(c)
return c.options.oid == item.commit.oid
end, { limit = 256 })
end)

if found then
vim.api.nvim_win_set_cursor(win, { found.position.row_start, 0 })
Expand Down
9 changes: 0 additions & 9 deletions lua/neogit/lib/ui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ end

function Ui._find_component(components, f, options)
for _, c in ipairs(components) do
if options.limit then
if options.limit == 0 then
return nil
end

options.limit = options.limit - 1
end

if (options.include_hidden and c.options.hidden) or not c.options.hidden then
if c.tag == "col" or c.tag == "row" then
local res = Ui._find_component(c.children, f, options)
Expand All @@ -98,7 +90,6 @@ end

---@class FindOptions
---@field include_hidden boolean
---@field limit number|nil

--- Finds a ui component in the buffer
---
Expand Down

0 comments on commit ec1faca

Please sign in to comment.