Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributedString fromAnsi <-> toAnsi does not round-trip convert correctly for box chars #805

Closed
uosis opened this issue Oct 29, 2022 · 0 comments
Milestone

Comments

@uosis
Copy link

uosis commented Oct 29, 2022

AttributedString.fromAnsi(
  new AttributedStringBuilder()
    .append("─")
    .toAttributedString()
    .toAnsi(terminal)
).toAnsi(terminal)

This prints garbage instead of "─".

Culprit appears to be adb1d94: toAnsi converts to alternate charset, but fromAnsi does not convert back. Setting DISABLE_ALTERNATE_CHARSET fixes the issue.

The implication of this is that it is not possible to use AttributedString to set prompt, because there is always round-trip conversion involved.

@uosis uosis changed the title AttributedString fromAnsi <-> toAnsi does not round-trip correctly for box chars AttributedString fromAnsi <-> toAnsi does not round-trip convert correctly for box chars Oct 29, 2022
gnodet added a commit to gnodet/jline3 that referenced this issue Mar 3, 2023
@gnodet gnodet added this to the 3.23.0 milestone Mar 3, 2023
@gnodet gnodet closed this as completed in 4dbe26b Mar 6, 2023
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

No branches or pull requests

2 participants