Fix bold leaking across legacy round-trip in panel lore#2918
Merged
tastybento merged 1 commit intodevelopfrom Apr 7, 2026
Merged
Fix bold leaking across legacy round-trip in panel lore#2918tastybento merged 1 commit intodevelopfrom
tastybento merged 1 commit intodevelopfrom
Conversation
Adventure's LegacyComponentSerializer does not emit §r when a sibling component clears a decoration that was set on a previous sibling, because legacy color codes have no "decoration off" code. The User.getTranslation → convertToLegacy → PanelItem.setDescription → parseMiniMessageOrLegacy round-trip then re-parses the legacy string under legacy semantics (decorations persist until §r), so bold leaked into following segments. Replace componentToLegacy with a Component walker that tracks emitted state and inserts §r at decoration-off transitions, re-applying color afterwards. Strengthen the existing round-trip test to assert that bold only applies to the intended segment. Fixes #2917 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2 tasks
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.



Summary
LegacyComponentSerializerdoes not emit§rwhen a sibling component clears a decoration that was set on a previous sibling — legacy color codes have no "decoration off" code. TheUser.getTranslation→convertToLegacy→PanelItem.setDescription→parseMiniMessageOrLegacyround-trip then re-parses under legacy semantics (decorations persist until§r), so bold leaked into the following segment.<green>Resets </green><red><bold>ALL </bold></red><green>the settings to their</green>rendered "the settings to their" as bold.Util.componentToLegacywith a Component walker that tracks emitted color/decorations and emits§rat decoration-off transitions, re-applying color afterwards.LegacyToMiniMessageTest.testRoundTripDoesNotProduceLiteralTagsto walk the round-tripped Component and assert that only"ALL "is bold (the previous test only checked plain text and missed the leak).Fixes #2917
Test plan
./gradlew test— full suite (2751 tests) passesLegacyToMiniMessageTestfails before the fix and passes after🤖 Generated with Claude Code