mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 10:00:29 +00:00
feat: adding and removing buffers from list
This commit is contained in:
parent
d98c514359
commit
5ec7f9200e
@ -28,7 +28,7 @@ describe("harpoon", function()
|
|||||||
eq(harpoon.ui.win_id, nil)
|
eq(harpoon.ui.win_id, nil)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("delete file from list via ui", function()
|
it("delete file from ui contents and save", function()
|
||||||
local created_files = utils.fill_list_with_files(3, harpoon:list())
|
local created_files = utils.fill_list_with_files(3, harpoon:list())
|
||||||
eq(harpoon:list():length(), 3)
|
eq(harpoon:list():length(), 3)
|
||||||
|
|
||||||
@ -40,4 +40,19 @@ describe("harpoon", function()
|
|||||||
eq(harpoon:list():length(), 2)
|
eq(harpoon:list():length(), 2)
|
||||||
eq(harpoon:list():display(), created_files)
|
eq(harpoon:list():display(), created_files)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("add file from ui contents and save", function()
|
||||||
|
local list = harpoon:list()
|
||||||
|
local created_files = utils.fill_list_with_files(3, list)
|
||||||
|
table.insert(created_files, os.tmpname())
|
||||||
|
|
||||||
|
eq(list:length(), 3)
|
||||||
|
|
||||||
|
harpoon.ui:toggle_quick_menu(list)
|
||||||
|
Buffer.set_contents(harpoon.ui.bufnr, created_files)
|
||||||
|
harpoon.ui:save()
|
||||||
|
|
||||||
|
eq(list:length(), 4)
|
||||||
|
eq(list:display(), created_files)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
@ -109,6 +109,7 @@ end
|
|||||||
function HarpoonUI:save()
|
function HarpoonUI:save()
|
||||||
local list = Buffer.get_contents(self.bufnr)
|
local list = Buffer.get_contents(self.bufnr)
|
||||||
self.active_list:resolve_displayed(list)
|
self.active_list:resolve_displayed(list)
|
||||||
|
self:close_menu()
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param settings HarpoonSettings
|
---@param settings HarpoonSettings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user