Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use stdout when initializing the terminal #72

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion simple-async-generated/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions simple-async-generated/src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<B: Backend> Tui<B> {
/// 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.
Expand Down Expand Up @@ -61,7 +61,7 @@ impl<B: Backend> Tui<B> {
/// 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(())
}

Expand Down
2 changes: 1 addition & 1 deletion simple-async/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions simple-async/src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<B: Backend> Tui<B> {
/// 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.
Expand Down Expand Up @@ -61,7 +61,7 @@ impl<B: Backend> Tui<B> {
/// 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(())
}

Expand Down
2 changes: 1 addition & 1 deletion simple-generated/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions simple-generated/src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<B: Backend> Tui<B> {
/// 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.
Expand Down Expand Up @@ -61,7 +61,7 @@ impl<B: Backend> Tui<B> {
/// 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(())
}

Expand Down
2 changes: 1 addition & 1 deletion simple/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions simple/src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<B: Backend> Tui<B> {
/// 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.
Expand Down Expand Up @@ -61,7 +61,7 @@ impl<B: Backend> Tui<B> {
/// 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(())
}

Expand Down