Using a chord to insert emoji changes all emoji on the line to "??"

Open
#3,371 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp, powershell
Domain
cli

Research direction

Start by reproducing the issue in Windows Terminal with Set-PSReadLineKeyHandler and the Microsoft.PowerShell.PSConsoleReadLine insert entry point. Check how chord insertion and subsequent keypresses handle emoji, and verify that inserted emoji render immediately without changing existing emoji on the line.

Written by the indexing model from the issue text.

Description

Issue-Emoji
Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.
Exception report
N/A
Screenshot

PowerShell-Core-2022-07-06-15-17-03

Environment data
PS Version: 7.2.5
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.2.6
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 30
Steps to reproduce

Use this code to add a chord which inserts an emoji (I have tried a few emoji, it happens for all of them):

Set-PSReadLineKeyHandler -Chord 'CTRL+y' -ScriptBlock {
    [Microsoft.PowerShell.PSConsoleReadLine]::insert('👍')
}

Then use the chord. First the emoji is inserted as ?? instead of the image, after pressing a normal letter or spacebar it turns into the image. Then using the chord again, the new emoji is inserted as ?? and all previously inserted emoji (the same emoji or different ones) change to ?? until pressing a normal letter or space returns them to being emoji.

Entering emoji through Windows' emoji keyboard (WIN+.) does not change the existing emoji in a line, and inserts them directly without entering ??. Then use the chord again, the emoji entered by Windows keyboard also turn to ??.

Expected behavior

Inserting an emoji makes it appear without needing any subsequent keypress to see them; existing emoji are unchanged while this happens.

Actual behavior

Inserting an emoji shows ?? until a subsequent keypress, and all existing emoji on the line turn to ?? until the subsequent keypress changes them back.

Dominant language
C#
Stars
4.4k
Forks
341
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PowerShell/PSReadLine

All issues in PowerShell/PSReadLine

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.