Skip to content
This repository has been archived by the owner on Aug 6, 2023. It is now read-only.

crossterm (re)size broken #250

Closed
extrawurst opened this issue Mar 22, 2020 · 10 comments · Fixed by #262
Closed

crossterm (re)size broken #250

extrawurst opened this issue Mar 22, 2020 · 10 comments · Fixed by #262
Labels

Comments

@extrawurst
Copy link
Contributor

Describe the bug
In order to prepare the pull request for the Clear-feature (#244) I pulled in the master and realized that crossterm terminal sizing seems broken: (see screenshot)

The terminal seems to have a default size and not using up the actual terminal size.
Also the resize events are not changing anything.

To Reproduce
In my case (macOS) I only need to run the Crossterm-demo:

cargo run --example crossterm_demo --no-default-features --features="crossterm" --release -- -tick-rate 200

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
image

Desktop (please complete the following information):

  • OS: macos
  • Terminal Emulator: iTerm2
  • Crate version: master
  • Backend: crossterm

Additional context
This was working as intended in the previous release

@extrawurst extrawurst added the bug label Mar 22, 2020
@heyrict
Copy link

heyrict commented Mar 25, 2020

Well, afaik the resize event should be handled manually in tui-rs. Sending resize events from crossterm backend by adding these lines to your event.rs should fix the issue.

@extrawurst
Copy link
Contributor Author

@heyrict "your events.rs"? as I said I am referring to the official demo from this repo. shouldn't this sort of thing be done in there if that's necessary? ;)

@heyrict
Copy link

heyrict commented Mar 25, 2020

@extrawurst Got it 👌

@extrawurst
Copy link
Contributor Author

I quickly reiterate the findings based on #252 (see #252 (comment))

The problem seems to be the fact that tui-rs does not specify any version for the Crossterm dependency: something seems to be broken when building with crossterm version >=0.16

@extrawurst
Copy link
Contributor Author

I now tried to build against the recent crossterm 0.17 and now the whole demo crashes:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: IoError(Custom { kind: Other, error: "Failed to initialize input reader" })', examples/crossterm_demo.rs:54:16

🙈

@heyrict
Copy link

heyrict commented Mar 25, 2020

Oh, my fault. I've just run the crossterm demo on the master branch, and found resizing just works.

It seems that the crossterm demo will implicitly send a tick event when resize in L54, and I've closed the PR as there is no need to add an explicit one.

... and now the whole demo crashes:

What if you handle the Result correctly?

@extrawurst
Copy link
Contributor Author

extrawurst commented Mar 25, 2020

Nope handling the Result means no input event is arrives anymore, this seems to be a separate issue/regression with crossterm release 0.17 though (filed: crossterm-rs/crossterm#404)

trying all commits from there It is also obvious that this is the commit that broke the resizing
crossterm-rs/crossterm@52b9d47

which means that for now the safest way is to pin crossterm for everyone to 0.16.0:

crossterm = { version="0.16.0", optional = true }

everything went south from there - 0.16.1 introduced the resizing issue - 0.17 breaks the whole input.

@extrawurst
Copy link
Contributor Author

extrawurst commented Mar 30, 2020

some update: the input issue on crossterm was fixed (crossterm-rs/crossterm#404):
so we can switch to a new release:

crossterm = { version="0.17.1", optional = true }

now we are back to just having the resize issue

@extrawurst
Copy link
Contributor Author

I can confirm that the resizing issue itself is also a regression in crossterm: crossterm-rs/crossterm#406

extrawurst pushed a commit to extrawurst/tui-rs that referenced this issue Apr 9, 2020
this fixes fdehau#250 because crossterm `0.17.3` has a fix for the resize/size issue
@extrawurst
Copy link
Contributor Author

crossterm 0.17.3 fixes the resize/size issue and a PR to upgrade to that version is open: #262

fdehau added a commit that referenced this issue Apr 12, 2020
this fixes #250 because crossterm `0.17.3` has a fix for the resize/size issue

Co-Authored-By: Florian Dehau <[email protected]>

Co-authored-by: Florian Dehau <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants