Skip to content

Fix \n in panel description fields not creating new lore lines#2853

Merged
tastybento merged 3 commits intodevelopfrom
copilot/fix-black-glass-description
Mar 14, 2026
Merged

Fix \n in panel description fields not creating new lore lines#2853
tastybento merged 3 commits intodevelopfrom
copilot/fix-black-glass-description

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

Literal \n sequences in YAML panel description fields (e.g. background, border, or content items) were silently ignored as line separators. Only descriptions coming from translated locale keys worked reliably, since locale files produce actual newline characters. Plain-text descriptions written directly in the panel YAML had no way to span multiple lore lines.

Root cause

PanelItemBuilder.description(String) splits on \n (actual newline char). SnakeYAML only produces actual newlines from double-quoted strings — plain and single-quoted strings preserve \n as the two-character literal sequence \\n, which the split never matched.

Fix

  • PanelItemBuilder.description(String) — normalise literal \\n\n before splitting, making all three YAML string styles work:
# All of these now produce two lore lines:
description: "line 1\nline 2"    # double-quoted: always worked
description: 'line 1\nline 2'    # single-quoted: now fixed
description: line 1\nline 2      # plain:         now fixed
description: |                   # block scalar:  always worked
  line 1
  line 2
  • PanelItemBuilderTest — adds testDescriptionStringWithActualNewline and testDescriptionStringWithLiteralBackslashN to cover both code paths.
Original prompt

This section details on the original issue you should resolve

<issue_title>Do not convert to a new line</issue_title>
<issue_description>### Expected behavior

when adding a description to the team panel and if you use \n, it should go to a new line.

Observed/Actual behavior

I see that where black glass is used, there is no normal description to add, but blue glass works fine
https://github.com/user-attachments/assets/4eacebfa-5db3-4c87-b922-0728e6365004

Steps/models to reproduce

  1. we go this way: /home/container/plugins/BentoBox/panels/team_panel.yml
  2. after that, we add a description of where the black glass is located, that is, in the background department
  3. The description does not work

BentoBox version

BentoBox - 2.6.0
Minecraft version - 1.21.1

Plugin list

No response

Other

https://github.com/user-attachments/assets/f8520987-2db5-4f6f-9be1-7159688544d1
https://github.com/user-attachments/assets/5d66de41-1426-4037-8c65-12fa87cc69e0

the same problem with team_invite_panel.yml
</issue_description>

Comments on the Issue (you are @copilot in this section)

@tastybento With YAML, the way to do new lines is like this usually. Does this work?
description: |
  This is line 1
  This is line 2
  This is line 3

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with description not converting new lines for black glass Fix \n in panel description fields not creating new lore lines Mar 14, 2026
Copilot AI requested a review from tastybento March 14, 2026 18:11
@tastybento tastybento marked this pull request as ready for review March 14, 2026 18:31
@tastybento tastybento merged commit 52d32b6 into develop Mar 14, 2026
1 check passed
@tastybento tastybento deleted the copilot/fix-black-glass-description branch March 14, 2026 18:57
@sonarqubecloud
Copy link
Copy Markdown

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.

Do not convert to a new line

2 participants