harpoon
harpoon copied to clipboard
Using list():select() re-creates a buffer when already existing buffer uses absolute path
Bug happens when using list():select() on a file in the buffer with the buffer path saved as absolute(or any way other than relative to the current working directory) because vim.fn.bufnr(to_exact_name(list_item.value))
returns -1.
This is most noticeable when you lose cursor position every time you use list():select().
https://github.com/neovim/neovim/issues/3764 describes how sometimes buffer path is saved as absolute, but its a complete mystery for me.
Steps to reproduce:
- Open a file and get its buffer path saved as absolute(see the link above).
- Do
:buffers
to confirm its absolute(or any way other than relative to the current working directory) - Set the cursor position to the second line
-
list():select()
the file - Observe how the cursor position gets reset to the first line