Additional space inserted at char 100 when a single-width emoji preceeds it #952

Closed
opened 2026-01-30 22:12:14 +00:00 by claunia · 1 comment
Owner

Originally created by @ritchiehughes on GitHub (May 10, 2019).

  • Your Windows build number: (Type ver at a Windows Command Prompt)
    Microsoft Windows [Version 10.0.18362.53]
    Windows Terminal appx download from GitHub: 0.1.1211.0

  • What you're doing and what's happening:

Ran a simple .NET Core 2.1 application (below) that outputs various UTF-8 emojis. Bug is that when a single-width (?) emoji is printed ("Computer Mouse"), the output includes an extra 'space' later on at character position 100. No issue when it's double-width ("Computer Disk"), :

image

  • What's wrong / what should be happening instead:

Text following the single-width emoji should not be modified or respaced.

Code sample (using Unicode.NET package from NuGet)

using NeoSmart.Unicode;
using System;
using System.Text;

namespace DetectWindowsTerminal
{
    class Program
    {
        static void Main(string[] args)
        {
            string a  = "ABCDEFGHIJKLMNOPQRSTUVWZYZ ";
            Console.OutputEncoding = Encoding.UTF8;

            Console.WriteLine($"123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_");
            Console.WriteLine($"--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100");
            Console.WriteLine($"{a}{a}{a}[{Emoji.ComputerMouse.ToString()}]{a}{a}");
            Console.WriteLine($"{a}{a}{a}[{Emoji.ComputerDisk.ToString()}]{a}{a}");
            Console.ReadLine();
        }
    }
}
Originally created by @ritchiehughes on GitHub (May 10, 2019). * Your Windows build number: (Type `ver` at a Windows Command Prompt) **Microsoft Windows [Version 10.0.18362.53]** **Windows Terminal appx download from GitHub: 0.1.1211.0** * What you're doing and what's happening: Ran a simple .NET Core 2.1 application (below) that outputs various UTF-8 emojis. Bug is that when a single-width (?) emoji is printed ("Computer Mouse"), the output includes an extra 'space' later on at **character position 100**. No issue when it's double-width ("Computer Disk"), : ![image](https://user-images.githubusercontent.com/18265132/57545713-73c1c980-7318-11e9-9f51-078e6cf73085.png) * What's wrong / what should be happening instead: Text following the single-width emoji should not be modified or respaced. **Code sample (using Unicode.NET package from NuGet)** ```csharp using NeoSmart.Unicode; using System; using System.Text; namespace DetectWindowsTerminal { class Program { static void Main(string[] args) { string a = "ABCDEFGHIJKLMNOPQRSTUVWZYZ "; Console.OutputEncoding = Encoding.UTF8; Console.WriteLine($"123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_"); Console.WriteLine($"--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100"); Console.WriteLine($"{a}{a}{a}[{Emoji.ComputerMouse.ToString()}]{a}{a}"); Console.WriteLine($"{a}{a}{a}[{Emoji.ComputerDisk.ToString()}]{a}{a}"); Console.ReadLine(); } } } ```
Author
Owner

@DHowett-MSFT commented on GitHub (Aug 28, 2019):

This is a couple issues. One is probably #2066 (disagreement between conpty and windows terminal about glyph width). The other is #1472 -- the Computer Mouse emoji is actually two codepoints that combine, and we, being simple and cell-based, don't understand these two codepoints to be a single grapheme cluster.

@DHowett-MSFT commented on GitHub (Aug 28, 2019): This is a couple issues. One is probably #2066 (disagreement between conpty and windows terminal about glyph width). The other is #1472 -- the Computer Mouse emoji is actually two codepoints that combine, and we, being simple and cell-based, don't understand these two codepoints to be a _single_ grapheme cluster.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#952