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

fix(encode): use a for-loop, instead of next() or ipairs(), to prevent loss of data #573

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

Conversation

kimabrandt-flx
Copy link

This fixes the issue, when there's an empty line inside the quick-menu, which causes everything after the blank line to be forgotten (after Neovim is restarted).

This also restores the blank lines, which I'm not certain of is expected or not?!

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
@kimabrandt-flx kimabrandt-flx changed the title fix(encode): use next() instead of ipairs(), to prevent loss of data fix(encode): use a for-loop, instead of next() or ipairs(), to prevent loss of data Apr 13, 2024
@kimabrandt-flx
Copy link
Author

There still seems to be an issue, when there are many blank items!? Some of them are just removed!? But, non-nil items seem to get restored alright!?

@PedroBinotto
Copy link

I think I might have found/fixed the same issue here #627 #628

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