Bad history with PSReadLine causes input problems #9619

Closed
opened 2026-01-31 01:59:25 +00:00 by claunia · 1 comment
Owner

Originally created by @ScatteredRay on GitHub (Jul 15, 2020).

Environment

Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd]
Windows Terminal version (if applicable):

Any other software?

Steps to reproduce

Open AppData/Roaming/Microsoft/Windows/Powershell/PSReadLine/ConsoleHost_history.txt and insert:

$AWSTemplate = @{`
    AWSTemplateFormatVersion = "2010-09-09"`
    Description = ""`
    Parameters = @{`
    }`
    Resources = @{`
        Vpc = @{`
            Type = "AWS::EC2::VPC"`
            Properties = @{`
                CidrBlock = "10.0.0.0/24"`
                EnableDnsSupport = $True`
                EnableDnsHostnames = $True`
            }`
        }`
        VpcSubnet = @{`
            Type = "AWS::EC2::Subnet"`
            Properties = @{`
                VpcId = @{ Ref = "Vpc" }`
                CidrBlock = "10.0.0.0/24"`
                MapPublicIpOnLaunch = $True`
            }`
        }`
        SecurityGroup = @{`
            Type = "AWS::EC2::SecurityGroup"`
            Properties = @{`
                GroupDescription = "SecurityGroup"`
                VpcId = @{ Ref = "Vpc" }`
                SecurityGroupIngress = @(`
                    # Ping`
                    @{`
                        CidrIp = "0.0.0.0/0"`
                        IpProtocol = "icmp"`
                        FromPort = -1`
                        ToPort = -1`
                    },`
                    # RDP`
                    @{`
                        CidrIp = "0.0.0.0/0"`
                        IpProtocol = "tcp"`
                        FromPort = 3389`
                        ToPort = 3389`
                    },`
                    # WinRM HTTPS`
                    @{`
                        CidrIp = "0.0.0.0/0"`
                        IpProtocol = "tcp"`
                        FromPort = 5986`
                        ToPort = 5986`
                    }`
                )`
            }`
        }`
        Instance = @{`
            Type = "AWS::EC2::Instance"`
            Properties = @{`
                InstanceType = "t3.large"`
                ImageId = $BaseImageId`
                SecurityGroupIds = @( @{Ref = "SecurityGroup"} )`
                SubnetId = @{ Ref = "VpcSubnet" }`
                KeyName = $KeyPair.KeyName`
            }c`
        }`
    }`
    Outputs = @{`
    }`
}convert

now open Windows terminal and use Ctrl-r to search history and start typing in AWSTemplate, See that at some point refresh is messed up.

Hit enter, notice continuing typing leaves extra `bck-i-search' characters in the terminal

Expected behavior

Windows terminal to not get in a bad state regardless of what's in the history

Actual behavior

windows terminal gets in a bad state

Originally created by @ScatteredRay on GitHub (Jul 15, 2020). # Environment ```none Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd] Windows Terminal version (if applicable): Any other software? ``` # Steps to reproduce Open AppData/Roaming/Microsoft/Windows/Powershell/PSReadLine/ConsoleHost_history.txt and insert: ``` $AWSTemplate = @{` AWSTemplateFormatVersion = "2010-09-09"` Description = ""` Parameters = @{` }` Resources = @{` Vpc = @{` Type = "AWS::EC2::VPC"` Properties = @{` CidrBlock = "10.0.0.0/24"` EnableDnsSupport = $True` EnableDnsHostnames = $True` }` }` VpcSubnet = @{` Type = "AWS::EC2::Subnet"` Properties = @{` VpcId = @{ Ref = "Vpc" }` CidrBlock = "10.0.0.0/24"` MapPublicIpOnLaunch = $True` }` }` SecurityGroup = @{` Type = "AWS::EC2::SecurityGroup"` Properties = @{` GroupDescription = "SecurityGroup"` VpcId = @{ Ref = "Vpc" }` SecurityGroupIngress = @(` # Ping` @{` CidrIp = "0.0.0.0/0"` IpProtocol = "icmp"` FromPort = -1` ToPort = -1` },` # RDP` @{` CidrIp = "0.0.0.0/0"` IpProtocol = "tcp"` FromPort = 3389` ToPort = 3389` },` # WinRM HTTPS` @{` CidrIp = "0.0.0.0/0"` IpProtocol = "tcp"` FromPort = 5986` ToPort = 5986` }` )` }` }` Instance = @{` Type = "AWS::EC2::Instance"` Properties = @{` InstanceType = "t3.large"` ImageId = $BaseImageId` SecurityGroupIds = @( @{Ref = "SecurityGroup"} )` SubnetId = @{ Ref = "VpcSubnet" }` KeyName = $KeyPair.KeyName` }c` }` }` Outputs = @{` }` }convert ``` now open Windows terminal and use Ctrl-r to search history and start typing in `AWSTemplate`, See that at some point refresh is messed up. Hit enter, notice continuing typing leaves extra `bck-i-search' characters in the terminal # Expected behavior Windows terminal to not get in a bad state regardless of what's in the history # Actual behavior windows terminal gets in a bad state
claunia added the Resolution-ExternalNeeds-Tag-Fix labels 2026-01-31 01:59:25 +00:00
Author
Owner

@DHowett commented on GitHub (Jul 15, 2020):

Thanks for the report! This looks like an issue with PSReadline (powershell's history management and line editing module) when the height of the history item is taller than the height of the screen buffer. It would probably be worth filing on the PSReadline repository.

@DHowett commented on GitHub (Jul 15, 2020): Thanks for the report! This looks like an issue with PSReadline (powershell's history management and line editing module) when the height of the history item is taller than the height of the screen buffer. It would probably be worth filing on the [PSReadline repository](https://github.com/powershell/psreadline).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9619