Skip to content

Append §r reset after prefix substitution to prevent formatting leakage#2907

Merged
tastybento merged 3 commits into
developfrom
copilot/fix-bold-formatting-issue
Apr 5, 2026
Merged

Append §r reset after prefix substitution to prevent formatting leakage#2907
tastybento merged 3 commits into
developfrom
copilot/fix-bold-formatting-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 5, 2026

Prefix translations like <gold><bold>[BentoBox]: </bold></gold> are converted to legacy §6§l[BentoBox]: with no trailing reset. When substituted into message strings, bold/italic decorations bleed into subsequent text because legacy formatting codes are sticky.

Changes

  • User.replacePrefixes(): Append §r after prefix translations that contain legacy formatting codes, so decorations are self-contained
  • UserTest: Add testPrefixBoldDoesNotLeak covering the prefix substitution path

Before/After

# Before: §6§l[BentoBox]:  Welcome!     → gold+bold leaks into "Welcome!"
# After:  §6§l[BentoBox]: §rWelcome!    → bold stops at prefix boundary

Copilot AI linked an issue Apr 5, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 5, 2026 04:51
When prefixes with bold/italic decorations (e.g. <gold><bold>[BentoBox]:
</bold></gold>) are converted to legacy § codes, the result has no reset
code at the end. When substituted into message strings, the bold formatting
leaks into subsequent text.

Fix: Append §r reset after prefix translations in replacePrefixes() to
prevent formatting leakage into surrounding message text.

Agent-Logs-Url: https://github.com/BentoBoxWorld/BentoBox/sessions/624d7e6b-da75-4336-aae6-8b078f0d5ec6

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix bold formatting issue in localization Append §r reset after prefix substitution to prevent formatting leakage Apr 5, 2026
Copilot AI requested a review from tastybento April 5, 2026 04:55
@tastybento tastybento marked this pull request as ready for review April 5, 2026 05:13
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 5, 2026

@tastybento tastybento merged commit 7f37ee3 into develop Apr 5, 2026
3 checks passed
@tastybento tastybento deleted the copilot/fix-bold-formatting-issue branch April 5, 2026 11:37
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.

The bold text continues

2 participants