Code Points with 0 width occupies one column #16641

Closed
opened 2026-01-31 05:18:12 +00:00 by claunia · 3 comments
Owner

Originally created by @eiximenis on GitHub (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

Originally created by @eiximenis on GitHub (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: ```cs 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](https://user-images.githubusercontent.com/5191049/152582908-55c67aea-32ff-45c3-b4d5-f8b203e0e4c1.png) 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](https://user-images.githubusercontent.com/5191049/152583246-01ca442b-8f6b-4df5-b404-9b00f7620bd6.png) 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
claunia added the Resolution-Duplicate label 2026-01-31 05:18:12 +00:00
Author
Owner

@j4james commented on GitHub (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.

@j4james commented on GitHub (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.
Author
Owner

@zadjii-msft commented on GitHub (Feb 9, 2022):

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

/dup #1472
/dup #8000

@zadjii-msft commented on GitHub (Feb 9, 2022): Yeah, I'd reckon those are the same thing. Thanks! /dup #1472 /dup #8000
Author
Owner

@ghost commented on GitHub (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 commented on GitHub (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!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16641