Psreadline: Clear screen using Ctrl+L is misbehaving when using the new console host in Windows 10 1809

Created on 1 Feb 2019  路  6Comments  路  Source: PowerShell/PSReadLine

Ever since upgrading to Windows 10 1809 clearing the screen using Ctrl+L no longer works as expected. I have observed the same behavior on at least 3 separate machines so the problem is easily reproduced.

Steps to reproduce

  1. Upgrade to Windows 10 1809
  2. Launch PowerShell or PowerShell Core
  3. Clear the console using Ctrl+L

Example:

[Ctrl+L]
ls

Observed behavior

When I press Ctrl+L the screen is cleared as expected but as soon as type any character the scroll position is reverted and all text comes back.

Expected behavior

Screen should remain cleared even when I start typing again.

Workarounds

  • Typing clear actually properly clears the buffer and does not suffer from this problem
  • Pressing enter after Ctrl+L seems to lock the scroll position
  • Checking "Use legacy console" in the console host settings seems to restore the normal behavor

Notes

WSL does not suffer from this problem even using the new console host.

Resolution-External

Most helpful comment

All 6 comments

I can repro that.

It seems related

https://github.com/lzybkr/PSReadLine/issues/854#issuecomment-462411250

Are you using a non-en-US keyboard layout?

I'm reproducing this alongside this weird variant of #841, on Windows 10 1809.

@Boboss74 I'm using es-ES layout but I can't reproduce #854.

Yeah, definitely conhost issue. The Clear-Host cmdlet works as expected as it uses the regular console API instead of a VT sequence.

Now that Windows 10 1903 is finally released and I have updated three machines and can confirm that the update does indeed resolve the issue. Thanks for the help!

Was this page helpful?
0 / 5 - 0 ratings