Skip to content
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

[Harpoon 2] Duplicate list items cause all following list items to be deleted #476

Open
maxrzaw opened this issue Jan 6, 2024 · 5 comments

Comments

@maxrzaw
Copy link

maxrzaw commented Jan 6, 2024

Steps to reproduce

  1. Mark a file
  2. Go to a different file
  3. Create a duplicate of the list item and then select it from the UI by hitting <CR>
    image
  4. Open UI again and select first item (now the file is opened)

I would expect this to take me to README.md on step 3, but it does not. I go to my back to the current file.

Logs

config_default#create_list_item README.md
HarpoonList:append { index = -1, item = { context = { col = 6, row = 1 }, value = "README.md" } }
ui#toggle_quick_menu#opening __harpoon_files
select by keymap '' <-- Does not work here
ui#select_menu_item selecting item 2 from { "README.md", "README.md" } options
ui#close_menu name: __harpoon_files win and bufnr { bufnr = 17, win = 1010 }
toggle by BufLeave
ui#toggle_quick_menu#closing
ui#save { "README.md", "README.md" }
ui#toggle_quick_menu#opening __harpoon_files <-- open up UI for second time
select by keymap '' <-- Works this time
ui#select_menu_item selecting item 1 from { "README.md" } options
ui#close_menu name: __harpoon_files win and bufnr { bufnr = 11, win = 1005 }
toggle by BufLeave
ui#toggle_quick_menu#closing
ui#save { "README.md" }
config_default#select { context = { col = 31, row = 7 }, value = "README.md" } __harpoon_files

Deletes items after the first duplicate

Steps to Reproduce

Same as above, but there is another list item already. So when hitting <CR>, the list looks like:

1 README.MD
2 README.MD
3 file1.txt

and my cursor is on the second README.md.
When I open the list back up, the list looks like:

1 README.MD

Logs 2

ui#toggle_quick_menu#opening __harpoon_files
select by keymap ''
ui#select_menu_item selecting item 2 from { "README.md", "README.md", "file1.txt" } options
ui#close_menu name: __harpoon_files win and bufnr { bufnr = 4, win = 1002 }
toggle by BufLeave
ui#toggle_quick_menu#closing
ui#save { "README.md", "README.md", "file1.txt" }
config_default#create_list_item file1.txt
ui#toggle_quick_menu#opening __harpoon_files
select by keymap ''
ui#select_menu_item selecting item 1 from { "README.md" } options
ui#close_menu name: __harpoon_files win and bufnr { bufnr = 6, win = 1003 }
toggle by BufLeave
ui#toggle_quick_menu#closing
ui#save { "README.md" }
config_default#select { context = { col = 32, row = 7 }, value = "README.md" } __harpoon_files

@maxrzaw maxrzaw changed the title Adding and selecting a duplicate item does not open the file [Harpoon 2] Duplicate list items cause all following list items to be deleted Feb 3, 2024
@kimabrandt-flx
Copy link

kimabrandt-flx commented Apr 13, 2024

This issue seems to be related to PR #573. Duplicate items are turned into blank-lines (nil-items), which then trigger the issue, that's addressed in the PR.

@ThePrimeagen
Copy link
Owner

Duplicates are not allowed

@ThePrimeagen
Copy link
Owner

I'm going to have to think about how to solve this.

We most certainly cannot have duplicate items

@kimabrandt-flx
Copy link

@ThePrimeagen Does that go for empty lines also? In which case there would only be a single blank line left; or none, if they're not allowed?!

@ThePrimeagen
Copy link
Owner

Blank should be fine which should make this fix easy

Next week I should get another 4 hours on harpoon, finish this off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants