fix: remove incorrect start/end swap in Tree.Offset#612
Open
doganarif wants to merge 1 commit intocharmbracelet:masterfrom
Open
fix: remove incorrect start/end swap in Tree.Offset#612doganarif wants to merge 1 commit intocharmbracelet:masterfrom
doganarif wants to merge 1 commit intocharmbracelet:masterfrom
Conversation
Offset(start, end) takes independent skip counts for the beginning and end of the children list. The swap logic treated them as a range, silently reversing the values when start > end. Fixes charmbracelet#535
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CONTRIBUTING.md.Tree.Offset(start, end)swaps the values whenstart > end, treating them as a range. They are independent skip counts (beginning and end of the children list), so the swap silently produces wrong output.For example,
Offset(2, 1)on[A, B, C, D, E]was swapped toOffset(1, 2), giving[B, C]instead of the correct[C, D].Removes the swap, adds tests covering
start > end, equal offsets, and zero offsets.Fixes #535