Incorrect full-width char rendering #21481

Open
opened 2026-01-31 07:45:57 +00:00 by claunia · 0 comments
Owner

Originally created by @xiongnemo on GitHub (Apr 4, 2024).

Windows Terminal version

1.19.10821.0

Windows build number

10.0.19045.0

Other Software

SonicLair.Cli@1.2.0 which uses:
Terminal.Gui@1.6.4
Font is attached:
Sarasa Term SC Light Nerd Font Complete.zip

Steps to reproduce

Fire up an application with Terminal.GUI which renders full-width characters using a monospaced font.

I calculate what's the actual length the terminal should render, which shouldn't be the problem:

SonicLair.Cli/Tools/StringExtension.cs

namespace SonicLair.Cli.Tools
{
    public static class StringExtension
    {
        public static int StandardizedStringLength(this string input)
        {
            // each CJK rune is 2 letter width when using a monospaced font
            int length = 0;
            foreach (var c in input)
            {
                length += Rune.IsWideChar(c) ? 2 : 1;
            }
            return length;
        }
        public static string RunePadRight(this string stringToPad, int totalWidth, char paddingChar = ' ')
        {
            int standardizedStringLength = stringToPad.StandardizedStringLength();
            if (standardizedStringLength >= totalWidth)
            {
                return stringToPad;
            }
            return stringToPad.PadRight(totalWidth - (standardizedStringLength - stringToPad.Length), paddingChar);
        }
        public static string RunePadLeft(this string stringToPad, int totalWidth, char paddingChar = ' ')
        {
            int standardizedStringLength = stringToPad.StandardizedStringLength();
            if (standardizedStringLength >= totalWidth)
            {
                return stringToPad;
            }
            return stringToPad.PadLeft(totalWidth - (standardizedStringLength - stringToPad.Length), paddingChar);
        }
    }
}

Expected Behavior

This is a screenshot at 1.19.10302.0:
image

This is a screenshot using Windows's terminal:
image

Actual Behavior

This is a screenshot at 1.19.10821.0:
image

It can be inferred that wt renders three instead of two single-char-width when rendering full-width characters.
Also, the first line is missing. I'm not quite sure whether this is related...
P.S. AtlasEngine is enabled for both versions

Originally created by @xiongnemo on GitHub (Apr 4, 2024). ### Windows Terminal version 1.19.10821.0 ### Windows build number 10.0.19045.0 ### Other Software [SonicLair.Cli@1.2.0](https://github.com/xiongnemo/SonicLair.Cli) which uses: [Terminal.Gui@1.6.4](https://github.com/gui-cs/Terminal.Gui/tree/v1.6.4) Font is attached: [Sarasa Term SC Light Nerd Font Complete.zip](https://github.com/microsoft/terminal/files/14871774/Sarasa.Term.SC.Light.Nerd.Font.Complete.zip) ### Steps to reproduce Fire up an application with Terminal.GUI which renders full-width characters using a monospaced font. I calculate what's the actual length the terminal should render, which shouldn't be the problem: `SonicLair.Cli/Tools/StringExtension.cs` ```C# namespace SonicLair.Cli.Tools { public static class StringExtension { public static int StandardizedStringLength(this string input) { // each CJK rune is 2 letter width when using a monospaced font int length = 0; foreach (var c in input) { length += Rune.IsWideChar(c) ? 2 : 1; } return length; } public static string RunePadRight(this string stringToPad, int totalWidth, char paddingChar = ' ') { int standardizedStringLength = stringToPad.StandardizedStringLength(); if (standardizedStringLength >= totalWidth) { return stringToPad; } return stringToPad.PadRight(totalWidth - (standardizedStringLength - stringToPad.Length), paddingChar); } public static string RunePadLeft(this string stringToPad, int totalWidth, char paddingChar = ' ') { int standardizedStringLength = stringToPad.StandardizedStringLength(); if (standardizedStringLength >= totalWidth) { return stringToPad; } return stringToPad.PadLeft(totalWidth - (standardizedStringLength - stringToPad.Length), paddingChar); } } } ``` ### Expected Behavior This is a screenshot at `1.19.10302.0`: ![image](https://github.com/microsoft/terminal/assets/38759782/0755c5c6-2f73-4db6-8b34-7ab06f36413a) This is a screenshot using Windows's terminal: ![image](https://github.com/microsoft/terminal/assets/38759782/bdb2a549-3964-4971-847c-f9675665c6e8) ### Actual Behavior This is a screenshot at `1.19.10821.0`: ![image](https://github.com/microsoft/terminal/assets/38759782/abd2355c-ff29-4324-832a-b53b6543655f) It can be inferred that wt renders three instead of two single-char-width when rendering full-width characters. Also, the first line is missing. I'm not quite sure whether this is related... P.S. AtlasEngine is enabled for both versions
claunia added the Needs-TriageIssue-BugNeeds-Attention labels 2026-01-31 07:45:57 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21481