Skip to content

Windows PSReadline stores and restores multiple bits of console state before/after commands #964

Open
@DHowett-MSFT

Description

@DHowett-MSFT

Environment data

PSReadline version: 2.0.0-beta3
Windows

This applies to all extant versions of Powershell.

Steps to reproduce or exception report

There are a number of user preferences that are PSReadline stores and restores across command executions; it is arguable as to whether it is PSReadline's job to do so.

Most of these things happen here.

console.OutputEncoding = _singleton._initialOutputEncoding;
bool IsValid(ConsoleColor color)
{
return color >= ConsoleColor.Black && color <= ConsoleColor.White;
}
if (IsValid(_singleton._initialForeground)) {
console.ForegroundColor = _singleton._initialForeground;
}
if (IsValid(_singleton._initialBackground)) {
console.BackgroundColor = _singleton._initialBackground;
}
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Console.TreatControlCAsInput = oldControlCAsInput;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions