Skip to content

Commit

Permalink
fix compilation errors and warnings in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Oct 1, 2023
1 parent 3705489 commit 652b449
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
8 changes: 4 additions & 4 deletions examples/ratatui_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crossterm::terminal::{
use ratatui::backend::CrosstermBackend;
use ratatui::layout::{Constraint, Direction, Layout};
use ratatui::style::{Color, Modifier, Style};
use ratatui::text::{Span, Spans};
use ratatui::text::{Line, Span};
use ratatui::widgets::{Block, Borders, Paragraph};
use ratatui::Terminal;
use std::borrow::Cow;
Expand Down Expand Up @@ -225,9 +225,9 @@ impl<'a> Editor<'a> {

// Render message at bottom
let message = if let Some(message) = self.message.take() {
Spans::from(Span::raw(message))
Line::from(Span::raw(message))
} else if search_height > 0 {
Spans::from(vec![
Line::from(vec![
Span::raw("Press "),
Span::styled("Enter", Style::default().add_modifier(Modifier::BOLD)),
Span::raw(" to jump to first match and close, "),
Expand All @@ -245,7 +245,7 @@ impl<'a> Editor<'a> {
Span::raw(" to search previous"),
])
} else {
Spans::from(vec![
Line::from(vec![
Span::raw("Press "),
Span::styled("^Q", Style::default().add_modifier(Modifier::BOLD)),
Span::raw(" to quit, "),
Expand Down
5 changes: 2 additions & 3 deletions examples/ratatui_termion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::time::Duration;
use termion::event::Event as TermEvent;
use termion::input::{MouseTerminal, TermRead};
use termion::raw::IntoRawMode;
use termion::screen::AlternateScreen;
use termion::screen::IntoAlternateScreen;
use tui_textarea::{Input, Key, TextArea};

enum Event {
Expand All @@ -18,9 +18,8 @@ enum Event {
}

fn main() -> Result<(), Box<dyn Error>> {
let stdout = io::stdout().into_raw_mode()?;
let stdout = io::stdout().into_raw_mode()?.into_alternate_screen()?;
let stdout = MouseTerminal::from(stdout);
let stdout = AlternateScreen::from(stdout);
let backend = TermionBackend::new(stdout);
let mut term = Terminal::new(backend)?;

Expand Down
5 changes: 2 additions & 3 deletions examples/termion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::time::Duration;
use termion::event::Event as TermEvent;
use termion::input::{MouseTerminal, TermRead};
use termion::raw::IntoRawMode;
use termion::screen::AlternateScreen;
use termion::screen::IntoAlternateScreen;
use tui::backend::TermionBackend;
use tui::widgets::{Block, Borders};
use tui::Terminal;
Expand All @@ -18,9 +18,8 @@ enum Event {
}

fn main() -> Result<(), Box<dyn Error>> {
let stdout = io::stdout().into_raw_mode()?;
let stdout = io::stdout().into_raw_mode()?.into_alternate_screen()?;
let stdout = MouseTerminal::from(stdout);
let stdout = AlternateScreen::from(stdout);
let backend = TermionBackend::new(stdout);
let mut term = Terminal::new(backend)?;

Expand Down

0 comments on commit 652b449

Please sign in to comment.