Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear-Host does not clear terminal window #1955

Closed
AlexHimself opened this issue May 7, 2019 · 5 comments
Closed

Clear-Host does not clear terminal window #1955

AlexHimself opened this issue May 7, 2019 · 5 comments

Comments

@AlexHimself
Copy link

Issue Description

Clear-Host does not clear the powershell terminal window, but appears to do so. If you scroll up, there's a bunch of text that shouldn't be there.

Run the following code a couple of times and scroll around to see:

Clear-Host

[xml]$Doc = New-Object System.Xml.XmlDocument
$dec = $Doc.CreateXmlDeclaration("1.0","UTF-8",$null)
$doc.AppendChild($dec)
$text = @"
 
Test commment
Generated $(Get-Date)
v1.0
 
"@

$doc.AppendChild($doc.CreateComment($text))

Clear-Host

$doc.OuterXml

Attached Logs

Follow the instructions in the README about
capturing and sending logs.

Environment Information

Windows 10 Pro (18362.86)

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.18362
VSCode 1.33.1
PowerShell Extension Version 1.12.1

PowerShell Information

Name Value
PSVersion 5.1.18362.1
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.18362.1
BuildVersion 10.0.18362.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
azure-account ms-vscode 0.8.2
gitlens eamodio 9.7.1
powershell ms-vscode 1.12.1
powershellprotools ironmansoftware 4.5.1
team ms-vsts 1.149.2
vscode-azurefunctions ms-azuretools 0.17.0
vscode-gist kenhowardpdx 3.0.3
@SydneyhSmith
Copy link
Collaborator

Thanks for reporting this...This is not an isolated issue to the PowerShell Integrated Console issue...if you open up a regular "PowerShell" terminal in VSCode - note that this is the PowerShell console. Execute 1..100 and then cls. Note that you can still scroll back through the terminal history. This is a function of the terminal feature in VSCode. You can clear that terminal history using Ctrl+k. See microsoft/vscode#50225 for more details.

@SteveL-MSFT
Copy link
Member

See PowerShell/PowerShell#8606

@rjmholt rjmholt closed this as completed May 8, 2019
@TylerLeonhardt
Copy link
Member

I have some PR's out to address this since it's highly requested - #2316

@fourthborngoose
Copy link

[System.Console]::Clear() should work. Not ideal, but should still do the needful.

@ghost
Copy link

ghost commented May 25, 2023

Thank you for your comment, but please note that this issue has been closed for over a week. For better visibility, consider opening a new issue with a link to this instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants