From f55a68fb0fc91ffc0de30d274262fc2c1d16c86e Mon Sep 17 00:00:00 2001 From: pythops Date: Mon, 26 Aug 2024 22:13:36 +0200 Subject: [PATCH] fix: use stdout when initializing the terminal --- simple-async-generated/src/main.rs | 2 +- simple-async-generated/src/tui.rs | 4 ++-- simple-async/src/main.rs | 2 +- simple-async/src/tui.rs | 4 ++-- simple-generated/src/main.rs | 2 +- simple-generated/src/tui.rs | 4 ++-- simple/src/main.rs | 2 +- simple/src/tui.rs | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/simple-async-generated/src/main.rs b/simple-async-generated/src/main.rs index e15f285..4608770 100644 --- a/simple-async-generated/src/main.rs +++ b/simple-async-generated/src/main.rs @@ -21,7 +21,7 @@ async fn main() -> AppResult<()> { let mut app = App::new(); // Initialize the terminal user interface. - let backend = CrosstermBackend::new(io::stderr()); + let backend = CrosstermBackend::new(io::stdout()); let terminal = Terminal::new(backend)?; let events = EventHandler::new(250); let mut tui = Tui::new(terminal, events); diff --git a/simple-async-generated/src/tui.rs b/simple-async-generated/src/tui.rs index d90bbe3..b15541b 100644 --- a/simple-async-generated/src/tui.rs +++ b/simple-async-generated/src/tui.rs @@ -31,7 +31,7 @@ impl Tui { /// It enables the raw mode and sets terminal properties. pub fn init(&mut self) -> AppResult<()> { terminal::enable_raw_mode()?; - crossterm::execute!(io::stderr(), EnterAlternateScreen, EnableMouseCapture)?; + crossterm::execute!(io::stdout(), EnterAlternateScreen, EnableMouseCapture)?; // Define a custom panic hook to reset the terminal properties. // This way, you won't have your terminal messed up if an unexpected error happens. @@ -61,7 +61,7 @@ impl Tui { /// the terminal properties if unexpected errors occur. fn reset() -> AppResult<()> { terminal::disable_raw_mode()?; - crossterm::execute!(io::stderr(), LeaveAlternateScreen, DisableMouseCapture)?; + crossterm::execute!(io::stdout(), LeaveAlternateScreen, DisableMouseCapture)?; Ok(()) } diff --git a/simple-async/src/main.rs b/simple-async/src/main.rs index e15f285..4608770 100644 --- a/simple-async/src/main.rs +++ b/simple-async/src/main.rs @@ -21,7 +21,7 @@ async fn main() -> AppResult<()> { let mut app = App::new(); // Initialize the terminal user interface. - let backend = CrosstermBackend::new(io::stderr()); + let backend = CrosstermBackend::new(io::stdout()); let terminal = Terminal::new(backend)?; let events = EventHandler::new(250); let mut tui = Tui::new(terminal, events); diff --git a/simple-async/src/tui.rs b/simple-async/src/tui.rs index d90bbe3..b15541b 100644 --- a/simple-async/src/tui.rs +++ b/simple-async/src/tui.rs @@ -31,7 +31,7 @@ impl Tui { /// It enables the raw mode and sets terminal properties. pub fn init(&mut self) -> AppResult<()> { terminal::enable_raw_mode()?; - crossterm::execute!(io::stderr(), EnterAlternateScreen, EnableMouseCapture)?; + crossterm::execute!(io::stdout(), EnterAlternateScreen, EnableMouseCapture)?; // Define a custom panic hook to reset the terminal properties. // This way, you won't have your terminal messed up if an unexpected error happens. @@ -61,7 +61,7 @@ impl Tui { /// the terminal properties if unexpected errors occur. fn reset() -> AppResult<()> { terminal::disable_raw_mode()?; - crossterm::execute!(io::stderr(), LeaveAlternateScreen, DisableMouseCapture)?; + crossterm::execute!(io::stdout(), LeaveAlternateScreen, DisableMouseCapture)?; Ok(()) } diff --git a/simple-generated/src/main.rs b/simple-generated/src/main.rs index a9cdd13..0825249 100644 --- a/simple-generated/src/main.rs +++ b/simple-generated/src/main.rs @@ -20,7 +20,7 @@ fn main() -> AppResult<()> { let mut app = App::new(); // Initialize the terminal user interface. - let backend = CrosstermBackend::new(io::stderr()); + let backend = CrosstermBackend::new(io::stdout()); let terminal = Terminal::new(backend)?; let events = EventHandler::new(250); let mut tui = Tui::new(terminal, events); diff --git a/simple-generated/src/tui.rs b/simple-generated/src/tui.rs index 5039de5..4c92a8e 100644 --- a/simple-generated/src/tui.rs +++ b/simple-generated/src/tui.rs @@ -31,7 +31,7 @@ impl Tui { /// It enables the raw mode and sets terminal properties. pub fn init(&mut self) -> AppResult<()> { terminal::enable_raw_mode()?; - ratatui::crossterm::execute!(io::stderr(), EnterAlternateScreen, EnableMouseCapture)?; + ratatui::crossterm::execute!(io::stdout(), EnterAlternateScreen, EnableMouseCapture)?; // Define a custom panic hook to reset the terminal properties. // This way, you won't have your terminal messed up if an unexpected error happens. @@ -61,7 +61,7 @@ impl Tui { /// the terminal properties if unexpected errors occur. fn reset() -> AppResult<()> { terminal::disable_raw_mode()?; - ratatui::crossterm::execute!(io::stderr(), LeaveAlternateScreen, DisableMouseCapture)?; + ratatui::crossterm::execute!(io::stdout(), LeaveAlternateScreen, DisableMouseCapture)?; Ok(()) } diff --git a/simple/src/main.rs b/simple/src/main.rs index a9cdd13..0825249 100644 --- a/simple/src/main.rs +++ b/simple/src/main.rs @@ -20,7 +20,7 @@ fn main() -> AppResult<()> { let mut app = App::new(); // Initialize the terminal user interface. - let backend = CrosstermBackend::new(io::stderr()); + let backend = CrosstermBackend::new(io::stdout()); let terminal = Terminal::new(backend)?; let events = EventHandler::new(250); let mut tui = Tui::new(terminal, events); diff --git a/simple/src/tui.rs b/simple/src/tui.rs index 5039de5..4c92a8e 100644 --- a/simple/src/tui.rs +++ b/simple/src/tui.rs @@ -31,7 +31,7 @@ impl Tui { /// It enables the raw mode and sets terminal properties. pub fn init(&mut self) -> AppResult<()> { terminal::enable_raw_mode()?; - ratatui::crossterm::execute!(io::stderr(), EnterAlternateScreen, EnableMouseCapture)?; + ratatui::crossterm::execute!(io::stdout(), EnterAlternateScreen, EnableMouseCapture)?; // Define a custom panic hook to reset the terminal properties. // This way, you won't have your terminal messed up if an unexpected error happens. @@ -61,7 +61,7 @@ impl Tui { /// the terminal properties if unexpected errors occur. fn reset() -> AppResult<()> { terminal::disable_raw_mode()?; - ratatui::crossterm::execute!(io::stderr(), LeaveAlternateScreen, DisableMouseCapture)?; + ratatui::crossterm::execute!(io::stdout(), LeaveAlternateScreen, DisableMouseCapture)?; Ok(()) }