Incorrect cursor positioning for certain unicode special characters #22436

Closed
opened 2026-01-31 08:13:10 +00:00 by claunia · 4 comments
Owner

Originally created by @jjcarrier on GitHub (Oct 20, 2024).

Windows Terminal version

1.21.2701.0

Windows build number

10.0.22631.0

Other Software

Also tested on Windows Terminal v1.22.2702.0

Steps to reproduce

  1. Paste the following into the terminal
'✅' | Format-Hex

Observe cursor position, then press enter.

  1. Paste the following into the terminal
'👨‍👩‍👧‍👦' | Format-Hex

Expected Behavior

  1. The cursor position should be immediately following the x character.
  2. The cursor position should be immediately following the x character.

Actual Behavior

  1. The cursor position is off by one and you cannot move the cursor past the x character.
  2. The cursor position is many characters past where it should be.
Originally created by @jjcarrier on GitHub (Oct 20, 2024). ### Windows Terminal version 1.21.2701.0 ### Windows build number 10.0.22631.0 ### Other Software Also tested on Windows Terminal v1.22.2702.0 ### Steps to reproduce 1. Paste the following into the terminal ```pwsh '✅' | Format-Hex ``` Observe cursor position, then press enter. 2. Paste the following into the terminal ```pwsh '👨‍👩‍👧‍👦' | Format-Hex ``` ### Expected Behavior 1. The cursor position should be immediately following the `x` character. 2. The cursor position should be immediately following the `x` character. ### Actual Behavior 1. The cursor position is off by one and you cannot move the cursor past the `x` character. 2. The cursor position is many characters past where it should be.
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 08:13:11 +00:00
Author
Owner

@DHowett commented on GitHub (Oct 20, 2024):

Which shell are you using? Do you know whether it supports grapheme clusters?

The shell is unfortunately involved in cursor positioning. If it has an incongruous understanding of the layout of the screen from the terminal it is hosted in, it will tell Terminal the wrong cursor position.

@DHowett commented on GitHub (Oct 20, 2024): Which shell are you using? Do you know whether it supports grapheme clusters? The shell is unfortunately involved in cursor positioning. If it has an incongruous understanding of the layout of the screen from the terminal it is hosted in, it will tell Terminal the wrong cursor position.
Author
Owner

@jjcarrier commented on GitHub (Oct 20, 2024):

@DHowett I tried this on both PowerShell v7.4.5 and preview v7.5.0.

NOTE: I fixed incorrect instructions above that omitted the quotes, in case that caused confusion.

And regarding grapheme clusters, I am not familiar with this (a quick search suggests PowerShell does not have built-in support for this?), but I think this points to a solution for solving the issue I have with a custom pager. So, thank you for mentioning this.

@jjcarrier commented on GitHub (Oct 20, 2024): @DHowett I tried this on both PowerShell v7.4.5 and preview v7.5.0. NOTE: I fixed incorrect instructions above that omitted the quotes, in case that caused confusion. And regarding grapheme clusters, I am not familiar with this (a quick search suggests PowerShell does not have built-in support for this?), but I think this points to a solution for solving the issue I have with a custom pager. So, thank you for mentioning this.
Author
Owner

@lhecker commented on GitHub (Oct 21, 2024):

PowerShell indeed does not yet have support for complex graphemes and so it misplaces the cursor. That's not something we can fix on our side, unfortunately.

@lhecker commented on GitHub (Oct 21, 2024): PowerShell indeed does not yet have support for complex graphemes and so it misplaces the cursor. That's not something we can fix on our side, unfortunately.
Author
Owner

@lhecker commented on GitHub (Oct 21, 2024):

I'll be closing the issue for now. Let us know if you find any issues with our implementation when used with a shell/application that supports them. You can try cmd.exe, for instance.

@lhecker commented on GitHub (Oct 21, 2024): I'll be closing the issue for now. Let us know if you find any issues with our implementation when used with a shell/application that supports them. You can try cmd.exe, for instance.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22436