-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Upgrading from 0.10.x to 0.12.x break input #295
Comments
Mmm, we will look into this. We did a complete rewrite of input unix module. So yea there might me differences although our tests haven't shown any problems with it yet. |
Enter and Tab are now passed as separate Key enum items instead of characters. |
Ah yes that's it @jonathandturner, thanks for the search! |
Thanks @vmedea - the keys work now. The last issue is that it seems like crossterm continues to monitor the input after this code finishes. With 0.10.x, if you did sync inputs, crossterm would stop trying to read the input after the code left. But, as best as I can figure right now it seems that some of the input characters continue to get eaten after this code runs. |
Is there a way to tell crossterm to stop taking input, or at least pause taking input? |
@zrzka did you build any mechanism to stop reading after all channels are dropped? |
@TimonPost nope, the reading thread is still there even if you drop all (a)sync readers. I didn't do it because there's a huge input refactoring PR and it didn't make sense to spend so much time on it. Currently, there're couple of options for the crate users:
|
We can implement Arc for a type that's wraps the Receiver. We share this type and clone it for every consumer. Then we implement Drop for this type. This Drop is called when all references to Arc are dropped. Here we can stop the reader because there are no listeners. |
Closing this now, because the problem has been solved. Either use the old crossterm or wait for the input PR. It will be fixed in the near future. |
We'll stick with 0.10.x. We'd like to be able to upgrade but won't be able to until this gets fixed. |
Unfortunate, it will probably fixed in 0.14. 0.13 is going to be released this or next week. We are already working on the new input module so there is work in progress. But expect that to be released in about two or three weeks. (just estimating) |
@jonathandturner, we did a patch with #307. This might be related to your issue if you were on Windows. An |
@jonathandturner I use read_sync in broot. I ported my application to crossterm 0.13 and no character is eaten, so I'm sure it's feasible. If you're interested my implementation of an event reader is thread+channel based: https://github.com/Canop/termimad/blob/master/src/events/event_source.rs#L28 EDIT: I reproduce this problem when broot isn't closed (and thus the new thread of the sync reader isn't dropped even while the sync reader is): one key over two is lost. |
A temp fix is merged #308 |
Thanks @zrzka and @TimonPost for having been so fast in publishing a fix! |
@jonathandturner this appears to be fixed in 0.14 |
Hi all,
We use crossterm in nushell in a few different places, and have generally been pretty happy with it. Recently, I tried to update from 0.10.x to 0.12.x. While the API changes were easy to fix, the result was a system that no longer worked.
Does someone have a minute to look over https://github.com/nushell/nushell/blob/master/src/fuzzysearch.rs and let me know why it doesn't work in 0.12.x (ignoring the slight API differences)
Here are some of the issues we see with 0.12.x when we try it:
The text was updated successfully, but these errors were encountered: