Skip to content

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

Open
@HumanEquivalentUnit

Description

@HumanEquivalentUnit

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions