fix: reparent deck onto string-prefix sibling instead of no-op#5188
Draft
krMaynard wants to merge 2 commits into
Draft
fix: reparent deck onto string-prefix sibling instead of no-op#5188krMaynard wants to merge 2 commits into
krMaynard wants to merge 2 commits into
Conversation
reparented_name() used target.0.starts_with(&self.0) to detect a drop onto the dragged deck or one of its descendants. Because this compared the raw \x1f-joined names rather than component boundaries, a sibling whose name merely shares a string prefix (e.g. dragging foo::bar onto foo::barbaz) was misclassified as a descendant and the drop became a silent no-op. Compare on \x1f component boundaries so only the deck itself or a genuine descendant is treated as a no-op. Adds a regression assertion to the drag_drop test.
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.
Linked issue (required)
Closes #5183
Summary / motivation (required)
reparented_name()usedtarget.0.starts_with(&self.0)to detect a drop onto the dragged deck or one of its descendants. Because this compared the raw\x1f-joined names rather than component boundaries, a sibling whose name merely shares a string prefix (e.g. draggingfoo::barontofoo::barbaz) was misclassified as a descendant and the drop became a silent no-op.The fix compares on
\x1fcomponent boundaries so only the deck itself or a genuine descendant is treated as a no-op.Steps to reproduce (required, use N/A if not applicable)
foo::barandfoo::barbaz.foo::barontofoo::barbaz.barbecomingfoo::barbaz::bar.How to test (required)
Checklist (minimum)
./ninja checkor an equivalent relevant check locally.Details
Adds a regression assertion to the
drag_droptest. The full CI workflow (checkon Linux/macOS/Windows,format,minilints) was run against this exact commit on my fork: https://github.com/krMaynard/anki-fork/actions/runs/29983583656Before / after behavior (optional)
Before: reparenting onto a string-prefix sibling is a silent no-op. After: it reparents correctly.
Risk / compatibility / migration (optional)
Low risk.
UI evidence (required for visual changes; otherwise N/A)
N/A
Scope