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

List.RemoveItem doesn't update the indexes #1030

Closed
Ytiuca opened this issue Oct 4, 2024 · 3 comments
Closed

List.RemoveItem doesn't update the indexes #1030

Ytiuca opened this issue Oct 4, 2024 · 3 comments

Comments

@Ytiuca
Copy link

Ytiuca commented Oct 4, 2024

When using List.RemoveItem, it seems that the indexes are not updated causing problems when interacting with the items later on. For example I remove an item from the list and then I select an item in this list but it selects the next one.

@SamWhited
Copy link
Contributor

The list indexes are just the position in an internal slice so there's no need to "update" indexes anywhere (ie. they're not stored on list items or anything along those lines), when the item is removed the slice is shortened and the indexes will work.

An example showing this working can be found here, so something else must be going on with your code, but it doesn't appear to be a problem with RemoveItem: https://go.dev/play/p/S40ysrIIkVr

@rivo
Copy link
Owner

rivo commented Nov 3, 2024

@SamWhited is right, there is not index list or anything like that. @Ytiuca, maybe you want to describe the issue a bit more in detail and post some example code that illustrates it?

@Ytiuca
Copy link
Author

Ytiuca commented Nov 13, 2024

Yeah, it may be a problem with my code, I'm just a beginner X). I found a workaround in my code so

@rivo rivo closed this as completed Nov 13, 2024
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