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

feat(index-tracking): keep track of the list._index while navigating #574

Open
wants to merge 6 commits into
base: harpoon2
Choose a base branch
from

Conversation

kimabrandt-flx
Copy link

@kimabrandt-flx kimabrandt-flx commented Apr 11, 2024

This change tries to keep track of the list._index, by using an autocmd for BufEnter - which updates the index when entering a harpooned file - and setting the index for different functions inside the list.

There's room for improvements, but maybe it can help!?

This also removes the autocmd Filetype harpoon - which didn't seem to highlight the row?! - and replaces it with passing the index for setting the cursor to a row.

Maybe there should be an user-option, to enable this?!

This also merges #573, since I felt it's somehow related.

This change tries to keep track of the `list._index`, by using an
`autocmd` for `BufEnter` - which updates the index when entering a
harpooned file - and setting the index for different functions inside
the list.
This fixes the issue, when there's an empty line inside the quick-menu,
which causes everything after the blank line to be forgotten.
For `next()`, the order in which the indices are enumerated is not
specified[1], even for numeric indices. Even though it seemed to work,
now the encode-/decode-logic uses a numerical `for`-loop, which should
keep the order and not miss any items after a `nil`-item.

Also, the loop inside the `encode`-function, uses the `list._length`
instead of `#items`; which seems to ignore data, when there're 2 or more
`nil`-values!?

[1] https://www.lua.org/manual/5.1/manual.html#pdf-next
@mike-jl
Copy link

mike-jl commented Jul 17, 2024

Works well for me. Would be nice, if it could get merged.

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

Successfully merging this pull request may close these issues.

2 participants