vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

Clear-Host command scrolls instead of clearing history

Open daleecc opened this issue 9 years ago • 13 comments

System Details

  • Operating system name and version: Windows 7 (64-bit)
  • VS Code version: 1.10.2
  • PowerShell extension version: 0.10.0
  • Output from $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      5.0.10586.117
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.117
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

When executing the clear command, the action is to scroll to the top of the terminal rather than clearing the previous output.

After the next command executed, it can be difficult to find the beginning of the output as Ctrl+Home goes to the beginning of the session, not the last clear.

daleecc avatar Mar 15 '17 14:03 daleecc

This issue on the VS Code repo discusses the limitation in the integrated terminal: https://github.com/sourcelair/xterm.js/issues/106

daviwil avatar Jun 02 '17 22:06 daviwil

Ok, I have come up with a way to fix this. VS Code provides a command called workbench.action.terminal.clear which clears the terminal output correctly. I just need to wire up Clear-Host command so that it ultimately invokes that command in VS Code. Will get this fixed for the next release!

daviwil avatar Jun 22 '17 14:06 daviwil

Is the fix implemented in the latest Insiders update? I'm still having this issue. Currently working on a scraping project and this makes me rotate back to ISE :'(

KristofStroobants avatar Sep 07 '17 08:09 KristofStroobants

Every update of the Insiders version i hope to see this fixed, no joy so far :'-(

KristofStroobants avatar Sep 14 '17 08:09 KristofStroobants

I would love to see this fix implemented in the next release as well! With this fixed and the #region support coming in the next VSCode release, I can finally switch to VSCode full time for PowerShell!

Thank you for the hard work!

D3MaxT avatar Sep 27 '17 16:09 D3MaxT

This is a bug in VS Code unfortunately. To verify, start a new VS Code Integrated Terminal with powershell.exe, run Get-Process and then Clear-Host, observe that the screen clearing behavior is exactly the same as in the PowerShell extension's Integrated Console.

I'll have to discuss this with the VS Code team to get it resolved since there's nothing that can be done from within the PowerShell extension to fix it.

daviwil avatar Sep 27 '17 17:09 daviwil

Ah, I thought I read earlier that you had a fix for this. No worries. Hopefully there is an open issue for this in their repo.

Thank you for all your hard work!

D3MaxT avatar Sep 28 '17 19:09 D3MaxT

So i suppose this means that there is no ETA on this issue? Is there any other issue i can track ?

KristofStroobants avatar Oct 02 '17 09:10 KristofStroobants

Hi, is there any way to track if this is being handled? This is the last deal-breaking bug for me. I'd like to move over to VSCode but can't because of this bug :-|

KristofStroobants avatar Oct 24 '17 08:10 KristofStroobants

@daviwil Hi David, i'm sorry to keep going on about this. But i just had a hard time again with big chunks of data because of the host not clearing. Is there any ETA on this? Is this being look at at this moment? I really wish they fixed it, then i could leave behind the ISE once and for all.

KristofStroobants avatar Nov 16 '17 10:11 KristofStroobants

@CookieCrumbles please go upvote on sourcelair/xterm.js#106. This is an upstream issue that has to be fixed in VS Code's terminal.

As a workaround, there is a key shortcut ctrl+k that will clear the terminal completely when it has focus.

dragonwolf83 avatar Nov 18 '17 00:11 dragonwolf83

Cant it be implemented as a Ctrl+k type of work-around until its fixed?

stigjoergensen avatar Mar 19 '18 17:03 stigjoergensen

This is an issue with VSCode as it is the same with the vanilla PowerShell terminal as well as CMD. Please vote up this issue - https://github.com/Microsoft/vscode/issues/30638

rkeithhill avatar Mar 20 '18 00:03 rkeithhill