Open
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Steps to reproduce
- Install a brand new vanilla windows 2022 server without desktop (in my case in a proxmox VM with default settings, win2022 ISO downloaded from MS website as an evaluation copy).
- Install OpenSSH with sshd
- Connect to it from a remote client
- Check $Host.UI.RawUI.MaxPhysicalWindowSize
Expected behavior
$Host.UI.RawUI.MaxPhysicalWindowSize
should be at least as big as the client's size.
Actual behavior
$Host.UI.RawUI.MaxPhysicalWindowSize
is smaller than $Host.UI.RawUI.WindowSize
, resulting in tools trying to restore termcaps to use the wrong values.
Example: open/close vim.
Error details
Initially posted on the docs repo MicrosoftDocs/Console-Docs#302, but as the bug impacts openssh, reposting it here as well.
Environment data
PS C:\Users\Administrator> $PSVersionTable
Name Value
---- -----
PSVersion 7.3.9
PSEdition Core
GitCommitId 7.3.9
OS Microsoft Windows 10.0.20348
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Version
v9.4.0.0p1-Beta (OpenSSH_for_Windows_9.4, LibreSSL 3.7.3)
Visuals
Example:
- Check client terminal size
- Connect to the windows 2022 (no desktop) host
- Check $Host.UI.RawUI values - Notice MaxPhysicalWindowSize is lower than WindowSize
- Open/Close vim
- Check $Host.UI.RawUI again - Notice that vim restored the wrong value, resulting in a broken terminal.
$> stty size
50 145
$> ssh wintest1
PowerShell 7.3.9
PS C:\Users\Administrator> $Host.UI.RawUI
ForegroundColor : Gray
BackgroundColor : Black
CursorPosition : 0,2
WindowPosition : 0,0
CursorSize : 25
BufferSize : 145,50
WindowSize : 145,50
MaxWindowSize : 145,50
MaxPhysicalWindowSize : 1008,45
KeyAvailable : True
WindowTitle : Administrator: C:\Windows\system32\conhost.exe
PS C:\Users\Administrator> vim
PS C:\Users\Administrator> $Host.UI.RawUI
ForegroundColor : Gray
BackgroundColor : Black
CursorPosition : 0,18
WindowPosition : 0,0
CursorSize : 25
BufferSize : 145,45
WindowSize : 145,45
MaxWindowSize : 145,45
MaxPhysicalWindowSize : 1008,45
KeyAvailable : True
WindowTitle : Administrator: C:\Windows\system32\conhost.exe
PS C:\Users\Administrator>