Fix examples and doctests

pull/74/head
Antoine Büsch 6 years ago committed by Florian Dehau
parent 559c9c75f3
commit 70561b7c54

@ -439,21 +439,21 @@ fn draw_charts(f: &mut Frame<MouseBackend>, app: &App, area: Rect) {
fn draw_text(f: &mut Frame<MouseBackend>, area: Rect) {
let text = [
Text::Data("This is a paragraph with several lines. You can change style your text the way you want.\n\nFox example: "),
Text::StyledData("under", Style::default().fg(Color::Red)),
Text::Data(" "),
Text::StyledData("the", Style::default().fg(Color::Green)),
Text::Data(" "),
Text::StyledData("rainbow", Style::default().fg(Color::Blue)),
Text::Data(".\nOh and if you didn't "),
Text::StyledData("notice", Style::default().modifier(Modifier::Italic)),
Text::Data(" you can "),
Text::StyledData("automatically", Style::default().modifier(Modifier::Bold)),
Text::Data(" "),
Text::StyledData("wrap", Style::default().modifier(Modifier::Invert)),
Text::Data(" your "),
Text::StyledData("text", Style::default().modifier(Modifier::Underline)),
Text::Data(".\nOne more thing is that it should display unicode characters: 10€")
Text::Data("This is a paragraph with several lines. You can change style your text the way you want.\n\nFox example: ".into()),
Text::StyledData("under".into(), Style::default().fg(Color::Red)),
Text::Data(" ".into()),
Text::StyledData("the".into(), Style::default().fg(Color::Green)),
Text::Data(" ".into()),
Text::StyledData("rainbow".into(), Style::default().fg(Color::Blue)),
Text::Data(".\nOh and if you didn't ".into()),
Text::StyledData("notice".into(), Style::default().modifier(Modifier::Italic)),
Text::Data(" you can ".into()),
Text::StyledData("automatically".into(), Style::default().modifier(Modifier::Bold)),
Text::Data(" ".into()),
Text::StyledData("wrap".into(), Style::default().modifier(Modifier::Invert)),
Text::Data(" your ".into()),
Text::StyledData("text".into(), Style::default().modifier(Modifier::Underline)),
Text::Data(".\nOne more thing is that it should display unicode characters: 10€".into())
];
Paragraph::new(text.iter())
.block(

@ -114,7 +114,7 @@ fn draw(t: &mut Terminal<AlternateScreenBackend>, app: &App) -> Result<(), io::E
.margin(2)
.constraints([Constraint::Length(3), Constraint::Min(1)].as_ref())
.split(app.size);
Paragraph::new([Text::Data(&app.input)].iter())
Paragraph::new([Text::Data((&app.input).into())].iter())
.style(Style::default().fg(Color::Yellow))
.block(Block::default().borders(Borders::ALL).title("Input"))
.render(&mut f, chunks[0]);

@ -21,8 +21,8 @@ use widgets::{Block, Widget};
/// # use tui::layout::{Alignment};
/// # fn main() {
/// let text = [
/// Text::Data("First line\n"),
/// Text::StyledData("Second line\n", Style::default().fg(Color::Red))
/// Text::Data("First line\n".into()),
/// Text::StyledData("Second line\n".into(), Style::default().fg(Color::Red))
/// ];
/// Paragraph::new(text.iter())
/// .block(Block::default().title("Paragraph").borders(Borders::ALL))

Loading…
Cancel
Save