Bad history with PSReadLine causes input problems #9616

Open
opened 2026-01-31 01:59:22 +00:00 by claunia · 0 comments
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:22 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9616