mirror of
https://github.com/encounter/objdiff.git
synced 2025-12-12 06:45:20 +00:00
objdiff-cli: Migrate to ratatui for rendering
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
use std::panic;
|
||||
use std::{io::stdout, panic};
|
||||
|
||||
use crossterm::{
|
||||
cursor::Show,
|
||||
event::DisableMouseCapture,
|
||||
terminal::{disable_raw_mode, LeaveAlternateScreen},
|
||||
};
|
||||
|
||||
pub fn crossterm_panic_handler() {
|
||||
let original_hook = panic::take_hook();
|
||||
panic::set_hook(Box::new(move |panic_info| {
|
||||
let _ = crossterm::execute!(
|
||||
std::io::stderr(),
|
||||
crossterm::terminal::LeaveAlternateScreen,
|
||||
crossterm::event::DisableMouseCapture
|
||||
);
|
||||
let _ = crossterm::terminal::disable_raw_mode();
|
||||
let _ = crossterm::execute!(stdout(), LeaveAlternateScreen, DisableMouseCapture, Show);
|
||||
let _ = disable_raw_mode();
|
||||
original_hook(panic_info);
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user