crossterm icon indicating copy to clipboard operation
crossterm copied to clipboard

Resize events yield different results than `terminal::size` on Windows

Open generic-user1 opened this issue 3 years ago • 2 comments

Describe the bug On Windows, the Resize event yields results that are 1 less than the results from terminal::size.

To Reproduce

  1. Use crossterm on Windows
  2. Call terminal::size; store results
  3. Enter raw mode so events are processed
  4. Enter alternate screen so that Resize events are fired properly (required on CMD and PowerShell, not required on Windows Terminal)
  5. Call event::read and store the results of the first Event::Resize
  6. Leave alternate screen (if it was entered) and disable raw mode
  7. Compare results from terminal::size and Event::Resize

Expected behavior Results from Resize events match results from terminal::size

OS Windows 10 (10.0.19044 Build 19044)

Terminal/Console CMD, PowerShell, and Windows Terminal

generic-user1 avatar Sep 20 '22 08:09 generic-user1

It seems like the underlying issue is that the results from terminal::size have 1 added in each dimension, but the results from a Resize event never have anything added to them.

generic-user1 avatar Sep 20 '22 09:09 generic-user1

Opened PR #714 to fix this issue.

generic-user1 avatar Sep 20 '22 09:09 generic-user1