-
-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The harpoon list can have the wrong length #555
Comments
Should be easy fix |
I included a test for this scenario in the Harpoonline plugin. |
When implementing toggle functionality in my config I found another side effect of this issue.
Open the UI: There are two items. The first item is empty. I would expect one item, and the second file on index 1. I think this part might be the problem. |
The A.toggle = function()
local list = H.get_current_list()
local active_idx = H.find_active_idx(list)
local len = #list.items
if not active_idx or len == 0 then
list:add()
elseif active_idx == len then -- last item
list:remove_at(active_idx) --
else
-- must replace with the last item in order to avoid gaps
list:replace_at(active_idx, list.items[len])
end
end Unfortunately, I cannot submit a PR because I do not understand the purpose of methods |
wrong_length.mp4
Hello @ThePrimeagen,
First off, thanks for merging this PR
Using my plugin harpoonline, I discovered that the length of the list can be wrong. I use:
Up until recently this was working just fine.
See the video.
Reproduce:
harpoonline
still shows1
: -> The latest call tolength
returned 1. See this code fragmentThe text was updated successfully, but these errors were encountered: