Open DependentAppearance0 opened 4 years ago
I have investigated this and it depends on the console being used. Although I cannot reproduce your exact issue.
Using 'old fashioned' windows console no event are generated for vertical resize. This is because windows does not consider these to be buffer resize events. As far as it is concerned making it smaller keeps the same buffer size but adds a scroll bar, making it larger simply does nothing. The old windows console is a PITA for any resize. In this case your test app does nothing, it does not know that any resizing is happening
The spiffy new Windows Terminal behaves correctly. So your test app works fine and displays the correct info.
Maybe this was a bug fix in windows terminal, was this what you are using?
Note that PDCurses reported the same issue and they have a work around which involves checking to see if the screen size changed from time to time
I fixed the wrong size return. Will make a PR soon.
it seems like this is a bug indeed. I don't see any events fired when resized horizontally.
Describe the bug When reading events with read() and matching resize events resize events wont fire when resizing vertically.
To Reproduce This code demonstrates the problem
Using this code after changing the terminals size vertically and horizontally outputs
The size given from size() gives the correct height but the size from the event is the buffers size. This means that while if only resizing horizontally the size is correct there is no way to detect the height changing using just events as the buffers height stays constant.
Expected behavior I expected Resize events to contain the size of the window but they contain the size of the buffer. This means that resizing horizontally works perfectly but vertical resizes aren't recognized as the buffers size doesn't change. This is made even more confusing because size() returns the windows size and not the buffers size.
OS I have only tested this on windows.
Terminal/Console I have tested and confirmed that this happens both on cmd and powershell.