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

Code Points with 0 width occupies one column #12373

Closed
eiximenis opened this issue Feb 4, 2022 · 3 comments
Closed

Code Points with 0 width occupies one column #12373

eiximenis opened this issue Feb 4, 2022 · 3 comments
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@eiximenis
Copy link

eiximenis commented Feb 4, 2022

Windows Terminal version

1.11.3471.0

Windows build number

10.0.19043.1466

Other Software

No response

Steps to reproduce

Running following NET6 code in Windows Terminal:

using System.Globalization;
using System.Text;

var s = "\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d\udc67*";
var graphemes = StringInfo.GetTextElementEnumerator(s);
while (graphemes.MoveNext()) {
    Console.WriteLine("Grapheme:" + graphemes.Current);
    var runes = graphemes.Current.ToString().EnumerateRunes();
    foreach (var rune in runes) {
        Console.WriteLine($"\tRune [{rune}] is {rune.Value} (0x{rune.Value:x}) - {string.Join('\0', rune.ToString().Select(c => $"\\u{(int)c:x}"))}");
    }
}

Console.WriteLine("123456789|123456789|123456789|123456789|123456789|123456789|");
Console.WriteLine(s);

Expected Behavior

This code creates a string named s with one grapheme cluster (👩‍👩‍👧‍👧 and one asterisk). Iterates over both graphemes, printing its code points individually. When the code point U+200d is printed it occupies one column even thought is a 0-width code point.
That has the consequence that the grapheme is 11 columns wide (4 * 2+3) instead of 8 columns wide (4 * 2).
Here is a screenshot of the program running in WT:
image
As you can see, the * starts in column 12, and the individual U+200d printed have one column width.

Default Ubuntu terminal seems to handle this a little bit better: although the grapheme cluster is not shown as a single character but a sequence of its individual code points, the U+200d does not have any width, and the overall width of the grapheme is 8:
image
As you can see, the * starts in column 9 and the U+200d does not have any width

Actual Behavior

Zero width code points seems to occupy one column

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Feb 4, 2022
@j4james
Copy link
Collaborator

j4james commented Feb 6, 2022

I believe this is a known limitation of the current buffer implementation. I think it's probably covered by issue #1472, or more broadly #8000.

@zadjii-msft
Copy link
Member

Yeah, I'd reckon those are the same thing. Thanks!

/dup #1472
/dup #8000

@ghost
Copy link

ghost commented Feb 9, 2022

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost ghost added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

3 participants