crossterm icon indicating copy to clipboard operation
crossterm copied to clipboard

Incorrect return value of `event.read()` when the height of PowerShell is 0.

Open eternal-io opened this issue 3 years ago • 2 comments

Describe the bug

When the height of PowerShell is 0, event.read() will return Event::Resize(xxx, 65535).

To Reproduce

  • Clone the newest repo, run cargo run --example event-poll-read.
  • Drag the terminal's bottom-right corner to , them to (don't know how to express).
  • Click the up-arrow button on scroll bar to see the last output.

Expected behavior

Which should return Event::Resize(xxx, 0).

Don't know whether the width field will behave like this, because the width of any window on Windows could not be resized to no width.

OS

Windows 10

Terminal/Console

PowerShell

eternal-io avatar Jun 27 '21 16:06 eternal-io

Is there any use case to resizing powershell with height 0? This might be a winapi related problem where a size of 0 is seen as a minimized console that will not receive events. That is just a guess.

TimonPost avatar Jul 01 '21 10:07 TimonPost

I plan to write a simple TUI lib to provide an interface for my program, because Rust does not have any perfect GUI lib, and this move can make my program small.

Someone who bored like me may do this, and thanks to the 65535, my lib may print a large amount of lines. Which could make my program (terminal) no response.

Although I can avoid this by adding some ifs, it is not perfect anyway.

eternal-io avatar Jul 01 '21 14:07 eternal-io