Repository navigation
Fix wide characters printed under DEC line drawing from taking up two columns #14549
Replies: 5 comments
|
!vouch |
|
We love edge case fixes. Be sure and reference the |
|
@jcollie thanks for steering me in the right direction, will do! |
|
FYI, it's not the widths that are wrong - it's the mapping of emoji to spaces. The purpose of the The standard for this is defined in DEC STD 070-3, which is based on ISO 2022. These are also the documents that Xterm would be following. |
Uh oh!
There was an error while loading. Please reload this page.
What do you want to change?
Hi, I'm Rob and I'm looking to make my first contribution.
Ghostty supports legacy charsets such as DEC line drawing, which programs use for box borders. When one of those charsets is active, Ghostty prints any character it can't map (e.g., anything above 0xFF, such as emoji) as a space, and it sizes that space from the original character, so an emoji becomes a two-column space and everything after it on the line shifts one column right.
Here's how to reproduce toggling line drawing:
Tested on Ghostty macOS 1.3.1
The fix is to map each printed character through its charset exactly once and write padding cells without the charset.
Why do you want to make this change?
I'm working on a CLI app that uses
libghostty-vtto keep snapshots and keep a copy of each session's terminal. When I reopen the app, it sends that copy back as VT output, and it's misaligned.Honestly, it's an edge case, as programs usually switch back to normal text before printing emoji characters, but it will be a problem for multiplexer apps that support legacy or web clients that don't use a binary protocol.
I don't think my proposed fix will materially impact performance either, since it's a one-function change.
I acknowledge that:
All reactions