feat: introduce reorder event

This commit is contained in:
Will Hopkins 2023-12-09 01:43:55 -08:00
parent 70703d6ce1
commit 90dc9599e3
No known key found for this signature in database
GPG Key ID: 643B8C585BABBB68
2 changed files with 7 additions and 0 deletions

View File

@ -147,6 +147,12 @@ function HarpoonList:resolve_displayed(displayed)
)
new_list[i] = self.config.create_list_item(self.config, v)
else
if index ~= i then
Listeners.listeners:emit(
Listeners.event_names.REORDER,
{ list = self, item = self.items[index], idx = i }
)
end
local index_in_new_list =
index_of(new_list, self.items[index], self.config)
if index_in_new_list == -1 then

View File

@ -52,5 +52,6 @@ return {
ADD = "ADD",
SELECT = "SELECT",
REMOVE = "REMOVE",
REORDER = "REORDER",
},
}