Bug: When headless, GetLargestConsoleWindowSize reports a MUCH too small size
#2,712 opened on Sep 10, 2019
Repository metrics
- Stars
- (35,764 stars)
- PR merge metrics
- (Avg merge 27d 19h) (24 merged PRs in 30d)
Description
Environment
ssh client: recent internal build of Windows
ssh server: recent internal build of Windows (WCOS)
vim: custom build that can load on the server
In a headless pseudoconsole session (such as over ssh), GetLargestConsoleWindowSize is reporting a maximum possible window size of 640 columns and 18 rows (on my particular SKU of Windows, which might differ from others). 640 columns isn't bad, I suppose, but 18 rows is downright tiny. I debugged a bit and found that internally (in conhost) this is due to a "screen" size in pixels of 640x300, and a font size of {1, 16}. (Of course there is not really a screen or pixels in a headless scenario, and that font size seems strange.)
Over ssh, I believe the console does not have any way to determine the ssh client's maximum possible window size (it doesn't know the size of the monitor the client is using, or the font being used, or even if it's a windows machine). It can be notified of window size changes on the client side (section 6.7: "Window Dimension Change Message" of RFC 4254), but not what the max possible size is. (Although I know very little about ssh; it's possible there's some extension or convention or something.)
So I propose that since there is no monitor hooked up to a headless session, GetLargestConsoleWindowSize should just report { SHRT_MAX, SHRT_MAX } (and let the client deal with whatever happens if the client sets the console's size too big).
(Without this, vim running in an ssh session is stuck at 18 lines high and cannot be made any bigger.)