Open NecroTechno opened 4 years ago
Thanks for the report!
Seems to be a bug in the crossterm wrapper code, where we apparently detect a "mouse drag event" before a "mouse press event" is detected.
I changed that to use the upstream button rather than our own "last_button" logic; can you try the latest git master to see if it fixes your crash?
Yep, that's fixed it! Thanks for the super quick response! :)
Sorry, perhaps I was a little too quick to celebrate. It seems on the on the master branch I can no longer detect the WindowResize event. Doesn't crash, but even regular resize of dragging the corners of the prompt no longer triggers the event.
Blast! Not sure what fails here. I'll check if it's a problem in crossterm itself, or in the wrapper code.
Ah you may have been caught by another change: WindowResize
is now a pre-event, so you'll need to use Cursive::set_on_pre_event
to add callbacks for that, instead of add_default_callback
.
Unfortunately, still doesn't seem to be catching the event, either by double clicking the bar or dragging the window. Maybe I'm doing something else incorrectly?
pub fn resize(siv: &mut Cursive, state_manager: &'static Mutex<StateManager>) {
siv.pop_layer();
siv.add_layer(
OnEventView::new(
Dialog::around(TextView::new("Please increase the size of your terminal."))
.title("Menu"),
)
.on_pre_event(Event::WindowResize, move |s| {
let screen_size = s.screen_size();
if screen_size.x >= 120 && screen_size.y >= 30 {
menu(s, state_manager);
}
}),
);
}
I've tried logging inside the closure, but I'm getting nothing.
Thanks so much for your help!
Bug Report
Using the "double click to maximise window" feature on the Windows command prompt causes the program to crash. Following the stack trace, it appears to be the unwrap on one of the mouse events in the map_key function in backend/crossterm.rs. See the stack trace below.
Environment