You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PowerShell 7.2.0 - arrow navigation does not work on Linux, outputs letters on arrow key presses #16606
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-ExternalThe issue is caused by external component(s).WG-Interactive-Consolethe console experience
2.2.0-beta4 - 2021-10-27
You can get the v2.2.0-beta4 version of the PSReadLine module from PowerShell Gallery.
This release includes the following changes:
This may be individual linux setting or settings of PSReadline module. What outputs:
Get-PSReadLineKeyHandler | Where { $_.key -like '*Arrow' }
And one more question -- what linux distribution do you use? I am using Arco Linux (arch-based) and always install or update Powershell from tar package.
This may be individual linux setting or settings of PSReadline module. What outputs:
Get-PSReadLineKeyHandler | Where { $_.key -like '*Arrow' }
And one more question -- what linux distribution do you use? I am using Arco Linux (arch-based) and always install or update Powershell from tar package.
>Get-PSReadLineKeyHandler|Where { $_.key-like'*Arrow' }
Cursor movement functions
=========================
Key Function Description
----------------------
LeftArrow BackwardChar Move the cursor back one character
RightArrow ForwardChar Move the cursor forward one character
History functions
=================
Key Function Description
----------------------
DownArrow NextHistory Replace the input with the next item in the history
UpArrow PreviousHistory Replace the input with the previous item in the history
Selection functions
===================
Key Function Description
----------------------
Shift+LeftArrow SelectBackwardChar Adjust the current selection to include the previous character
Shift+RightArrow SelectForwardChar Adjust the current selection to include the next character
When you press Up, the terminal sends the sequence:
(if it's in normal mode) CSI A, where CSI means Control Sequence Introducer and is produced by ESC [; in caret notation, the >whole sequence is displayed as ^[[A
(if it's in application mode) SS3 A, where SS3 is described as Single Shift Select of G3 Character Set here, and is produced by ESC O; in caret notation, the whole sequence is displayed as ^[OA
So, it looks your terminal is in application mode for some reason.
I never needed to install PSReadline explicitly until now, and up to v7.1.5 everything worked fine. I think that I have the latest installed though, as Install-Module PSReadline returns immediately and without error.
2.2.0-beta4 - 2021-10-27
You can get the v2.2.0-beta4 version of the PSReadLine module from PowerShell Gallery.
This release includes the following changes:
When you press Up, the terminal sends the sequence:
(if it's in normal mode) CSI A, where CSI means Control Sequence Introducer and is produced by ESC [; in caret notation, the >whole sequence is displayed as ^[[A
(if it's in application mode) SS3 A, where SS3 is described as Single Shift Select of G3 Character Set here, and is produced by ESC O; in caret notation, the whole sequence is displayed as ^[OA
So, it looks your terminal is in application mode for some reason.
In the same terminal:
$ # Install PowerShell 7.1.5
$ sudo pacman -U ~/AUR/powershell-bin/powershell-bin-7.1.5-1-x86_64.pkg.tar.zst
...
$ pwsh
PowerShell 7.1.5
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
A new PowerShell stable release is available: v7.2.0
Upgrade now, or check out the release page at:
https://aka.ms/PowerShell-Release?tag=v7.2.0
PS /home> # Arrows work...
PS /home> exit
$ # Install PowerShell 7.2.0
$ sudo pacman -U ~/AUR/powershell-bin/powershell-bin-7.2.0-1-x86_64.pkg.tar.zst
...
$ pwsh
PowerShell 7.2.0
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
PS /home> OAODOCODOAODOCODOCOAODOCOAOD
PS /home> # Arrows don't work...
Interesting, PS 7.1.5 and PS 7.2 both ship the 2.1.0 version of PSReadLine module, so it's not because of the PSReadLine module.
PS 7.1.5 uses .NET 5 while PS 7.2 uses .NET 6. I suspect something is changed in Console.ReadKey. Can you please try [System.Console]::ReadKey($true) and press UpArrow in both PS 7.1.5 and PS 7.2 and share the results here?
In my environment there are not problems. As I said I installed PowerShell just unpacking powershell-7.2.0-linux-x64.tar.gz to /opt/microsoft/powershell/7/ and created symbolic link from /opt/microsoft/powershell/7/pwsh to /usr/bin/pwsh.
Interesting, PS 7.1.5 and PS 7.2 both ship the 2.1.0 version of PSReadLine module, so it's not because of the PSReadLine module. PS 7.1.5 uses .NET 5 while PS 7.2 uses .NET 6. I suspect something is changed in Console.ReadKey. Can you please try [System.Console]::ReadKey($true) and press UpArrow in both PS 7.1.5 and PS 7.2 and share the results here?
$ pwsh
PowerShell 7.2.0
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
PS /home> [System.Console]::ReadKey($true)
KeyChar Key Modifiers
------- --- ---------
UpArrow 0
PS /home> exit
$ sudo pacman -U ~/AUR/powershell-bin/powershell-bin-7.1.5-1-x86_64.pkg.tar.zst
...
$ pwsh
PowerShell 7.1.5
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
A new PowerShell stable release is available: v7.2.0
Upgrade now, or check out the release page at:
https://aka.ms/PowerShell-Release?tag=v7.2.0
PS /home> [System.Console]::ReadKey($true)
KeyChar Key Modifiers
------- --- ---------
UpArrow 0
PS /home> exit
So, it looks your terminal is in application mode for some reason.
Actually, .NET requires application mode to support Arrow key escape sequences. So being in application mode is expected.
Run out of clues at this point ... Can you try the PS 7.2.1 that was released yesterday? It's on top of .NET 6.0.1.
Indeed! Just as chaplina said!
I use the rxvt-unicode terminal as my main terminal, and it worked fine with PS 7.1.x. Now, with 7.2.x, I must run TERM=xterm-256color pwsh for the arrows to work.
Problem is the same when using bastion logon to VM running and then start pwsh (7.2.1). TERM=xterm-256color pwsh Works.
Possibly something to do with Ascii colorcoding from Get-PSReadLineOption?
7.1.x ships with 2.1.0 version of PSReadLine, and 7.2.x ships the same version PSReadLine, so the issue you ran into should have nothing to do with PSReadLine. It's likely an issue rooted in .NET 6.
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-ExternalThe issue is caused by external component(s).WG-Interactive-Consolethe console experience
Activity
iSazonov commentedon Dec 13, 2021
blochl Please install latest PSReadline version and check again. https://github.com/PowerShell/PSReadLine/releases/tag/v2.2.0-beta4
237dmitry commentedon Dec 13, 2021
This may be individual linux setting or settings of PSReadline module. What outputs:
And one more question -- what linux distribution do you use? I am using Arco Linux (arch-based) and always install or update Powershell from tar package.
blochl commentedon Dec 13, 2021
I'm using Arch Linux.
daxian-dbw commentedon Dec 13, 2021
According to the answer in https://vi.stackexchange.com/a/15328:
So, it looks your terminal is in application mode for some reason.
blochl commentedon Dec 13, 2021
I never needed to install PSReadline explicitly until now, and up to v7.1.5 everything worked fine. I think that I have the latest installed though, as
Install-Module PSReadlinereturns immediately and without error.blochl commentedon Dec 13, 2021
In the same terminal:
daxian-dbw commentedon Dec 13, 2021
Interesting, PS 7.1.5 and PS 7.2 both ship the 2.1.0 version of PSReadLine module, so it's not because of the PSReadLine module.
PS 7.1.5 uses .NET 5 while PS 7.2 uses .NET 6. I suspect something is changed in
Console.ReadKey. Can you please try[System.Console]::ReadKey($true)and pressUpArrowin both PS 7.1.5 and PS 7.2 and share the results here?iSazonov commentedon Dec 13, 2021
I see only one change dotnet/runtime#42432
237dmitry commentedon Dec 13, 2021
In my environment there are not problems. As I said I installed PowerShell just unpacking powershell-7.2.0-linux-x64.tar.gz to
/opt/microsoft/powershell/7/and created symbolic link from/opt/microsoft/powershell/7/pwshto/usr/bin/pwsh.I think you have to try other terminal emulator. I am using Tilix.
blochl commentedon Dec 13, 2021
daxian-dbw commentedon Dec 16, 2021
Actually, .NET requires application mode to support Arrow key escape sequences. So being in application mode is expected.
Run out of clues at this point ... Can you try the PS 7.2.1 that was released yesterday? It's on top of .NET 6.0.1.
blochl commentedon Dec 16, 2021
Same with 7.2.1. (Installed from: https://github.com/PowerShell/PowerShell/releases/download/v7.2.1/powershell_7.2.1-1.deb_amd64.deb)
chaplina commentedon Dec 18, 2021
I was having this same issue. I ssh to the Oracle Enterprise Linux 7 host from my PC using urxvt and the TERM is set to rxvt.
I decided to export TERM=xterm and run pwsh and the command recall using arrow keys started to work again.
Since this was working fine pre 7.2 I'd consider this a bug. :)
blochl commentedon Dec 20, 2021
Indeed! Just as chaplina said!
I use the rxvt-unicode terminal as my main terminal, and it worked fine with PS 7.1.x. Now, with 7.2.x, I must run
TERM=xterm-256color pwshfor the arrows to work.Thanks, chaplina , for the workaround.
And it does look like a bug / regression.
B-Art commentedon Dec 21, 2021
Problem is the same when using bastion logon to VM running and then start
pwsh(7.2.1).TERM=xterm-256color pwshWorks.Possibly something to do with Ascii colorcoding from
Get-PSReadLineOption?daxian-dbw commentedon Jan 3, 2022
7.1.x ships with 2.1.0 version of PSReadLine, and 7.2.x ships the same version PSReadLine, so the issue you ran into should have nothing to do with PSReadLine. It's likely an issue rooted in .NET 6.
daxian-dbw commentedon Jan 5, 2022
Opened the issue dotnet/runtime#63387 on dotnet/runtime.
Read up/down keys on *nix properly - fixes #11