up-arrow glitch on Win Powershell 5.1 #7954

Closed
opened 2026-01-31 01:16:44 +00:00 by claunia · 14 comments
Owner

Originally created by @MikeMM70 on GitHub (May 5, 2020).

Environment

Windows Terminal 0.11.1191.0 (It was also in older versions I had tried as well)
Windows 10 Pro x64 Version 1909 build 18363.778
AMD Phenom II x6 1055T
AMD Radeon RX 480 Graphics (Driver version 26.20.15029.27016 4/21/2020)

Any other software?

$host.Version:
Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      18362  752

Does not happen with a Powershell 7 tab:

$host.version
Major  Minor  Build  Revision
-----  -----  -----  --------
7      0      0      -1

I did reset my Windows Terminal config back to default.

Steps to reproduce

replicate (on my system anyway):

ipconfig /all <enter>
<up arrow>
<down arrow>
cls <enter>

Expected behavior

<up arrow> just displays the previous command and not move the cursor.

Actual behavior

<up arrow> displays the previous command but then moved the cursor up 4 or 5 lines

WinTerm-PS5 1-glitch

This behavior does NOT happen on an old laptop I have (Lenovo X131e, same version of Windows, Windows Powershell 5.1 and Terminal) AMD E2-1800 APU with Radeon HD 7340 graphics, Driver ver 15.201.1151.0 - 8/21/2015)

Originally created by @MikeMM70 on GitHub (May 5, 2020). # Environment Windows Terminal 0.11.1191.0 (It was also in older versions I had tried as well) Windows 10 Pro x64 Version 1909 build 18363.778 AMD Phenom II x6 1055T AMD Radeon RX 480 Graphics (Driver version 26.20.15029.27016 4/21/2020) Any other software? ``` $host.Version: Major Minor Build Revision ----- ----- ----- -------- 5 1 18362 752 ``` **Does not happen with a Powershell 7 tab**: ``` $host.version Major Minor Build Revision ----- ----- ----- -------- 7 0 0 -1 ``` I did reset my Windows Terminal config back to default. # Steps to reproduce replicate (on my system anyway): ``` ipconfig /all <enter> <up arrow> <down arrow> cls <enter> ``` # Expected behavior \<up arrow\> just displays the previous command and not move the cursor. # Actual behavior \<up arrow\> displays the previous command but then moved the cursor up 4 or 5 lines ![WinTerm-PS5 1-glitch](https://user-images.githubusercontent.com/10885147/81092575-c8b60280-8ece-11ea-81e0-fa3bc8d4b3c1.jpg) This behavior does NOT happen on an old laptop I have (Lenovo X131e, same version of Windows, Windows Powershell 5.1 and Terminal) AMD E2-1800 APU with Radeon HD 7340 graphics, Driver ver 15.201.1151.0 - 8/21/2015)
claunia added the Resolution-Duplicate label 2026-01-31 01:16:44 +00:00
Author
Owner

@zadjii-msft commented on GitHub (May 6, 2020):

This is weird, I can't repro this with the 0.11.200423001-selfhost0.11 build I've got laying around (roughly 0.11.1141), nor can I repro this with 0.11.1204.0 (which should be similar to 0.11.1251.0 which was just released).

Could you try updating? This might have been fixed by #5627

@zadjii-msft commented on GitHub (May 6, 2020): This is weird, I can't repro this with the `0.11.200423001-selfhost0.11` build I've got laying around (roughly 0.11.1141), nor can I repro this with 0.11.1204.0 (which should be similar to [0.11.1251.0](https://github.com/microsoft/terminal/releases/tag/v0.11.1251.0) which was just released). Could you try updating? This might have been fixed by #5627
Author
Owner

@MikeMM70 commented on GitHub (May 6, 2020):

I just updated Terminal, along with the cumulative update for Windows 1909,
and I can still replicate it on this computer. Obviously it will have to be
a very low priority to fix if I am the only one with the problem. I know
how difficult it is to troubleshoot what you can't replicate yourself.
Thanks for looking at it anyway.

Michael M. Minor

@MikeMM70 commented on GitHub (May 6, 2020): I just updated Terminal, along with the cumulative update for Windows 1909, and I can still replicate it on this computer. Obviously it will have to be a very low priority to fix if I am the only one with the problem. I know how difficult it is to troubleshoot what you can't replicate yourself. Thanks for looking at it anyway. Michael M. Minor
Author
Owner

@MikeMM70 commented on GitHub (May 6, 2020):

Oh, and the CLS isn't really part of the problem, it just makes it more
obvious to see after it happens. The initial is where it really
happens - the command line goes to the most recent, then the cursor jumps
up 5 lines.
[image: Windows Terminal Glitch.png]

Michael M. Minor

@MikeMM70 commented on GitHub (May 6, 2020): Oh, and the CLS isn't really part of the problem, it just makes it more obvious to see after it happens. The initial <up arrow> is where it really happens - the command line goes to the most recent, then the cursor jumps up 5 lines. [image: Windows Terminal Glitch.png] Michael M. Minor
Author
Owner

@DHowett-MSFT commented on GitHub (May 7, 2020):

This is one of those things that PowerShell 7 improves.

Now, it looks like you have some local powershell customizations. Judging by the fact that your prompt is different than the default powershell prompt.

Can you share the output of

gc function:/Prompt

?
Thanks!

@DHowett-MSFT commented on GitHub (May 7, 2020): This is one of those things that PowerShell 7 improves. Now, it looks like you have some local powershell customizations. Judging by the fact that your prompt is different than the default powershell prompt. Can you share the output of ``` gc function:/Prompt ``` ? Thanks!
Author
Owner

@MikeMM70 commented on GitHub (May 7, 2020):

1 C:\Users\Michael PS>gc function:/Prompt

    Write-Host ('{0} ' -f ((Get-History -Count 1).Id + 1)) -NoNewLine
@MikeMM70 commented on GitHub (May 7, 2020): 1 C:\Users\Michael PS>gc function:/Prompt Write-Host ('{0} ' -f ((Get-History -Count 1).Id + 1)) -NoNewLine
Author
Owner

@DHowett-MSFT commented on GitHub (May 7, 2020):

Huh, nothing more than that?

@DHowett-MSFT commented on GitHub (May 7, 2020): Huh, nothing more than that?
Author
Owner

@DHowett-MSFT commented on GitHub (May 7, 2020):

(I ask only because it looks like you also have a working directory in there... so I was worried that it got cut off.)

@DHowett-MSFT commented on GitHub (May 7, 2020): (I ask only because it looks like you also have a _working directory_ in there... so I was worried that it got cut off.)
Author
Owner

@MikeMM70 commented on GitHub (May 7, 2020):

If I set the Prompt function to the same as my Powershell 7 Prompt, the
problem goes away. That prompt function I have on 5.1 works fine if I open
a normal Powershell 5.1 Window, so I still think it is a glitch either in
OpenConHost or Terminal, but it's appearing to be a tiny corner-case.
Either that or the function was bad but worked because of a glitch in the
old Powershell 5.1 setup. Honestly, I'm not even sure why I have a
non-standard Prompt function on here. I use Powershell a lot more at work
and at my old job I had several things added to my prompt, but not so much
here on my home system,

Michael M. Minor

@MikeMM70 commented on GitHub (May 7, 2020): If I set the Prompt function to the same as my Powershell 7 Prompt, the problem goes away. That prompt function I have on 5.1 works fine if I open a normal Powershell 5.1 Window, so I still think it is a glitch either in OpenConHost or Terminal, but it's appearing to be a tiny corner-case. Either that or the function was bad but worked because of a glitch in the old Powershell 5.1 setup. Honestly, I'm not even sure why I have a non-standard Prompt function on here. I use Powershell a lot more at work and at my old job I had several things added to my prompt, but not so much here on my home system, Michael M. Minor
Author
Owner

@DHowett-MSFT commented on GitHub (May 7, 2020):

That's really interesting. I'd like to make sure we don't have that corner case.

What does the custom prompt look like in your profile.ps1? 😄

@DHowett-MSFT commented on GitHub (May 7, 2020): That's really interesting. I'd like to make sure we _don't_ have that corner case. What does the custom prompt look like in your `profile.ps1`? :smile:
Author
Owner

@MikeMM70 commented on GitHub (May 7, 2020):

I've attached my profile script. The part that may be responsible, after
looking at it, may be:
#set the buffer size
$Shell = $Host.UI.RawUI
$Bsize = $Shell.BufferSize
#$Bsize.width=170
$Bsize.height=5000
$Shell.BufferSize = $Bsize
#Set the initial window size
$Wsize = $Shell.WindowSize

$Wsize.width=170

$Wsize.height=25
$Shell.WindowSize = $Wsize

Michael M. Minor

On Thu, May 7, 2020 at 12:10 PM Dustin L. Howett (MSFT) <
notifications@github.com> wrote:

That's really interesting. I'd like to make sure we don't have that
corner case.

What does the custom prompt look like in your profile.ps1? 😄


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/microsoft/terminal/issues/5753#issuecomment-625350025,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACTBQGYB5HT6Q5MEFOVBLWLRQLMQHANCNFSM4MZYOTFQ
.

function playvid {param($pathname) ; &"C:\Program Files\MPC-HC\mpc-hc64.exe" /fullscreen $pathname}
function get-function {param([string]$funct); get-item function:$funct |select name,Definition,Description,Visibility,HelpURI}
#set the buffer size
$Shell = $Host.UI.RawUI
$Bsize = $Shell.BufferSize
#$Bsize.width=170
$Bsize.height=5000
$Shell.BufferSize = $Bsize
#Set the initial window size
$Wsize = $Shell.WindowSize

$Wsize.width=170

$Wsize.height=25
$Shell.WindowSize = $Wsize

function Test-Administrator
{
$user = [Security.Principal.WindowsIdentity]::GetCurrent();
(New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
<# PSReadLine handles history, this is no longer needed
If (Test-Administrator) {$histFile = 'History_Admin.clixml'} else {$histFile = 'History.clixml'}
$MaximumHistoryCount = 200
$historyPath = Join-Path (split-path $profile) $histFile # history.clixml

Register-EngineEvent -SourceIdentifier powershell.exiting -Action {
Get-History -Count $MaximumHistoryCount | Get-Unique | Export-Clixml (Join-Path (split-path $profile) $histFile ) #history.clixml)
}| out-null

Load previous history, if it exists

if ((Test-Path $historyPath)) {
Import-Clixml $historyPath | ? {$count++;$true} | Add-History
Write-Host -Fore Green "nLoaded $count history item(s).n"
}
#>

if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadline
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
}
function prompt {
Write-Host ('{0} ' -f ((Get-History -Count 1).Id + 1)) -NoNewLine -ForegroundColor White -BackgroundColor Black
Write-Host (' {0}' -f $($executionContext.SessionState.Path.CurrentLocation)) -ForegroundColor Gray -NoNewline
Write-Host (' ') -NoNewline
}

function which ($command) {
Get-Command -Name $command -CommandType all -ErrorAction SilentlyContinue |
#Select-Object -ExpandProperty Path -ErrorAction SilentlyContinue
Format-Table Name, CommandType, Path -auto
}

function get-uptime {
(get-date) - (gcim Win32_OperatingSystem).LastBootUpTime}

@MikeMM70 commented on GitHub (May 7, 2020): I've attached my profile script. The part that may be responsible, after looking at it, may be: #set the buffer size $Shell = $Host.UI.RawUI $Bsize = $Shell.BufferSize #$Bsize.width=170 $Bsize.height=5000 $Shell.BufferSize = $Bsize #Set the initial window size $Wsize = $Shell.WindowSize # $Wsize.width=170 $Wsize.height=25 $Shell.WindowSize = $Wsize Michael M. Minor On Thu, May 7, 2020 at 12:10 PM Dustin L. Howett (MSFT) < notifications@github.com> wrote: > That's really interesting. I'd like to make sure we *don't* have that > corner case. > > What does the custom prompt look like in your profile.ps1? 😄 > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/microsoft/terminal/issues/5753#issuecomment-625350025>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/ACTBQGYB5HT6Q5MEFOVBLWLRQLMQHANCNFSM4MZYOTFQ> > . > function playvid {param($pathname) ; &"C:\Program Files\MPC-HC\mpc-hc64.exe" /fullscreen $pathname} function get-function {param([string]$funct); get-item function:$funct |select name,Definition,Description,Visibility,HelpURI} #set the buffer size $Shell = $Host.UI.RawUI $Bsize = $Shell.BufferSize #$Bsize.width=170 $Bsize.height=5000 $Shell.BufferSize = $Bsize #Set the initial window size $Wsize = $Shell.WindowSize # $Wsize.width=170 $Wsize.height=25 $Shell.WindowSize = $Wsize function Test-Administrator { $user = [Security.Principal.WindowsIdentity]::GetCurrent(); (New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) } <# PSReadLine handles history, this is no longer needed If (Test-Administrator) {$histFile = 'History_Admin.clixml'} else {$histFile = 'History.clixml'} $MaximumHistoryCount = 200 $historyPath = Join-Path (split-path $profile) $histFile # history.clixml Register-EngineEvent -SourceIdentifier powershell.exiting -Action { Get-History -Count $MaximumHistoryCount | Get-Unique | Export-Clixml (Join-Path (split-path $profile) $histFile ) #history.clixml) }| out-null # Load previous history, if it exists if ((Test-Path $historyPath)) { Import-Clixml $historyPath | ? {$count++;$true} | Add-History Write-Host -Fore Green "`nLoaded $count history item(s).`n" } #> if ($host.Name -eq 'ConsoleHost') { Import-Module PSReadline Set-PSReadLineOption -HistorySearchCursorMovesToEnd Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward } function prompt { Write-Host ('{0} ' -f ((Get-History -Count 1).Id + 1)) -NoNewLine -ForegroundColor White -BackgroundColor Black Write-Host (' {0}' -f $($executionContext.SessionState.Path.CurrentLocation)) -ForegroundColor Gray -NoNewline Write-Host (' ') -NoNewline } function which ($command) { Get-Command -Name $command -CommandType all -ErrorAction SilentlyContinue | #Select-Object -ExpandProperty Path -ErrorAction SilentlyContinue Format-Table Name, CommandType, Path -auto } function get-uptime { (get-date) - (gcim Win32_OperatingSystem).LastBootUpTime}
Author
Owner

@DHowett-MSFT commented on GitHub (May 7, 2020):

Oh gosh, that will absolutely screw Terminal up. It’s supposed to set the window size, right? Definitely don’t need to do that!

@DHowett-MSFT commented on GitHub (May 7, 2020): Oh gosh, that will _absolutely_ screw Terminal up. It’s supposed to set the window size, right? Definitely don’t need to do that!
Author
Owner

@MikeMM70 commented on GitHub (May 7, 2020):

Depending on what I am doing sometimes I'll have it open quite large, and I
like to have it open at a set size every time. Anyway, sorry for the
trouble and wasting your time, and thank you for the help.

Michael M. Minor

@MikeMM70 commented on GitHub (May 7, 2020): Depending on what I am doing sometimes I'll have it open quite large, and I like to have it open at a set size every time. Anyway, sorry for the trouble and wasting your time, and thank you for the help. Michael M. Minor
Author
Owner

@DHowett-MSFT commented on GitHub (May 7, 2020):

Not a problem; thanks for going back and forth with me! This is, at its heart, a /dupe of #5094.

@DHowett-MSFT commented on GitHub (May 7, 2020): Not a problem; thanks for going back and forth with me! This is, at its heart, a /dupe of #5094.
Author
Owner

@ghost commented on GitHub (May 7, 2020):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (May 7, 2020): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7954