mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 10:00:29 +00:00
fix: dedupe prepend
This commit is contained in:
parent
734d10bc6d
commit
65d652dccd
@ -44,7 +44,11 @@ end
|
|||||||
---@return HarpoonList
|
---@return HarpoonList
|
||||||
function HarpoonList:prepend(item)
|
function HarpoonList:prepend(item)
|
||||||
item = item or self.config.add()
|
item = item or self.config.add()
|
||||||
|
local index = index_of(self.config, self.items, item)
|
||||||
|
if index == -1 then
|
||||||
table.insert(self.items, 1, item)
|
table.insert(self.items, 1, item)
|
||||||
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user