From cba99406e0cadc9870a7bec0a57f98dfd7208d15 Mon Sep 17 00:00:00 2001 From: Gwen Lg Date: Thu, 17 Oct 2024 14:28:47 +0200 Subject: [PATCH] wip: tui test adjustement --- src/lib.rs | 2 +- src/main.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 94dc426..59ce682 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -102,7 +102,7 @@ pub enum Error { /// Will forward error from `ocr` processing and [`check_subtitles`] if any. #[profiling::function] pub fn run(opt: &Opt, terminal: Terminal) -> Result<(), Error> { - let mut picker = Picker::new((2, 3)); // (16, 24) Picker::from_termios().map_err(|source| Error::Picker(source.to_string()))?; + let mut picker = Picker::from_termios().unwrap_or_else(|_| Picker::new((2, 3))); // (16, 24) .map_err(|source| Error::Picker(source.to_string()))?; picker.guess_protocol(); rayon::ThreadPoolBuilder::new() diff --git a/src/main.rs b/src/main.rs index 1c6f80f..57deda6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ use anyhow::Context; use clap::Parser; use crossterm::{ execute, - terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, + terminal::{EnterAlternateScreen, LeaveAlternateScreen}, }; use log::LevelFilter; use ratatui::{ @@ -58,12 +58,12 @@ fn init_panic_hook() { })); } fn init_tui() -> io::Result> { - enable_raw_mode()?; + //enable_raw_mode()?; execute!(stdout(), EnterAlternateScreen)?; Terminal::new(CrosstermBackend::new(stdout())) } fn restore_tui() -> io::Result<()> { - disable_raw_mode()?; + //disable_raw_mode()?; execute!(stdout(), LeaveAlternateScreen)?; Ok(()) }