My personal-knowledge-system, with deeply integrated task tracking and long term goal planning capabilities.
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: panic hook now exits tui

+15 -1
+15 -1
src/errors.rs
··· 1 + use std::io::stdout; 2 + 3 + use crossterm::{ 4 + cursor, 5 + event::{DisableBracketedPaste, DisableMouseCapture}, 6 + terminal::LeaveAlternateScreen, 7 + }; 8 + 1 9 /// Sets the panic-hook to be customized color-eyre `panic_hook`. 2 10 /// 3 11 /// Additionally the panic handler prints different information ··· 15 23 16 24 eyre_hook.install()?; 17 25 std::panic::set_hook(Box::new(move |panic_info| { 18 - //TODO: exit from terminal if the app is in a terminal 26 + // exit from terminal if the app is in a terminal 27 + if crossterm::terminal::is_raw_mode_enabled().unwrap() { 28 + let _ = crossterm::execute!(stdout(), DisableBracketedPaste); 29 + let _ = crossterm::execute!(stdout(), DisableMouseCapture); 30 + let _ = crossterm::execute!(stdout(), LeaveAlternateScreen, cursor::Show); 31 + let _ = crossterm::terminal::disable_raw_mode(); 32 + } 19 33 20 34 // in release mode, do human_panic printing 21 35 #[cfg(not(debug_assertions))]