diff --git a/lua/harpoon2/list.lua b/lua/harpoon2/list.lua index 6c527067..bb79ceda 100644 --- a/lua/harpoon2/list.lua +++ b/lua/harpoon2/list.lua @@ -1,4 +1,5 @@ local Listeners = require("harpoon2.listeners") +local Buffer = require("harpoon2.buffer") local function index_of(items, element, config) local equals = config and config.equals diff --git a/lua/harpoon2/ui.lua b/lua/harpoon2/ui.lua index de16f8af..2b7690cc 100644 --- a/lua/harpoon2/ui.lua +++ b/lua/harpoon2/ui.lua @@ -102,6 +102,12 @@ end function HarpoonUI:select_menu_item() local idx = vim.fn.line(".") + + -- must first save any updates potentially made to the list before + -- navigating + local list = Buffer.get_contents(self.bufnr) + self.active_list:resolve_displayed(list) + self.active_list:select(idx) self:close_menu() end