mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-22 20:53:19 +00:00
Run cargo fmt
with the new Rust stable toolchain (1.31.0)
This commit is contained in:
parent
a2776dfc86
commit
8522e028f1
19 changed files with 143 additions and 88 deletions
|
@ -117,9 +117,11 @@ fn main() -> Result<(), failure::Error> {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
match events.next()? {
|
match events.next()? {
|
||||||
Event::Input(input) => if input == Key::Char('q') {
|
Event::Input(input) => {
|
||||||
|
if input == Key::Char('q') {
|
||||||
break;
|
break;
|
||||||
},
|
}
|
||||||
|
}
|
||||||
Event::Tick => {
|
Event::Tick => {
|
||||||
app.update();
|
app.update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,8 @@ fn main() -> Result<(), failure::Error> {
|
||||||
.fg(Color::White)
|
.fg(Color::White)
|
||||||
.bg(Color::Red)
|
.bg(Color::Red)
|
||||||
.modifier(Modifier::Bold),
|
.modifier(Modifier::Bold),
|
||||||
).render(&mut f, chunks[1]);
|
)
|
||||||
|
.render(&mut f, chunks[1]);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
let chunks = Layout::default()
|
let chunks = Layout::default()
|
||||||
|
@ -80,9 +81,11 @@ fn main() -> Result<(), failure::Error> {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
match events.next()? {
|
match events.next()? {
|
||||||
Event::Input(key) => if key == Key::Char('q') {
|
Event::Input(key) => {
|
||||||
|
if key == Key::Char('q') {
|
||||||
break;
|
break;
|
||||||
},
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,8 @@ fn main() -> Result<(), failure::Error> {
|
||||||
resolution: MapResolution::High,
|
resolution: MapResolution::High,
|
||||||
});
|
});
|
||||||
ctx.print(app.x, -app.y, "You are here", Color::Yellow);
|
ctx.print(app.x, -app.y, "You are here", Color::Yellow);
|
||||||
}).x_bounds([-180.0, 180.0])
|
})
|
||||||
|
.x_bounds([-180.0, 180.0])
|
||||||
.y_bounds([-90.0, 90.0])
|
.y_bounds([-90.0, 90.0])
|
||||||
.render(&mut f, chunks[0]);
|
.render(&mut f, chunks[0]);
|
||||||
Canvas::default()
|
Canvas::default()
|
||||||
|
@ -139,7 +140,8 @@ fn main() -> Result<(), failure::Error> {
|
||||||
y2: f64::from(app.ball.top()),
|
y2: f64::from(app.ball.top()),
|
||||||
color: Color::Yellow,
|
color: Color::Yellow,
|
||||||
});
|
});
|
||||||
}).x_bounds([10.0, 110.0])
|
})
|
||||||
|
.x_bounds([10.0, 110.0])
|
||||||
.y_bounds([10.0, 110.0])
|
.y_bounds([10.0, 110.0])
|
||||||
.render(&mut f, chunks[1]);
|
.render(&mut f, chunks[1]);
|
||||||
})?;
|
})?;
|
||||||
|
|
|
@ -80,7 +80,8 @@ fn main() -> Result<(), failure::Error> {
|
||||||
.title("Chart")
|
.title("Chart")
|
||||||
.title_style(Style::default().fg(Color::Cyan).modifier(Modifier::Bold))
|
.title_style(Style::default().fg(Color::Cyan).modifier(Modifier::Bold))
|
||||||
.borders(Borders::ALL),
|
.borders(Borders::ALL),
|
||||||
).x_axis(
|
)
|
||||||
|
.x_axis(
|
||||||
Axis::default()
|
Axis::default()
|
||||||
.title("X Axis")
|
.title("X Axis")
|
||||||
.style(Style::default().fg(Color::Gray))
|
.style(Style::default().fg(Color::Gray))
|
||||||
|
@ -91,14 +92,16 @@ fn main() -> Result<(), failure::Error> {
|
||||||
&format!("{}", (app.window[0] + app.window[1]) / 2.0),
|
&format!("{}", (app.window[0] + app.window[1]) / 2.0),
|
||||||
&format!("{}", app.window[1]),
|
&format!("{}", app.window[1]),
|
||||||
]),
|
]),
|
||||||
).y_axis(
|
)
|
||||||
|
.y_axis(
|
||||||
Axis::default()
|
Axis::default()
|
||||||
.title("Y Axis")
|
.title("Y Axis")
|
||||||
.style(Style::default().fg(Color::Gray))
|
.style(Style::default().fg(Color::Gray))
|
||||||
.labels_style(Style::default().modifier(Modifier::Italic))
|
.labels_style(Style::default().modifier(Modifier::Italic))
|
||||||
.bounds([-20.0, 20.0])
|
.bounds([-20.0, 20.0])
|
||||||
.labels(&["-20", "0", "20"]),
|
.labels(&["-20", "0", "20"]),
|
||||||
).datasets(&[
|
)
|
||||||
|
.datasets(&[
|
||||||
Dataset::default()
|
Dataset::default()
|
||||||
.name("data2")
|
.name("data2")
|
||||||
.marker(Marker::Dot)
|
.marker(Marker::Dot)
|
||||||
|
@ -109,13 +112,16 @@ fn main() -> Result<(), failure::Error> {
|
||||||
.marker(Marker::Braille)
|
.marker(Marker::Braille)
|
||||||
.style(Style::default().fg(Color::Yellow))
|
.style(Style::default().fg(Color::Yellow))
|
||||||
.data(&app.data2),
|
.data(&app.data2),
|
||||||
]).render(&mut f, size);
|
])
|
||||||
|
.render(&mut f, size);
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
match events.next()? {
|
match events.next()? {
|
||||||
Event::Input(input) => if input == Key::Char('q') {
|
Event::Input(input) => {
|
||||||
|
if input == Key::Char('q') {
|
||||||
break;
|
break;
|
||||||
},
|
}
|
||||||
|
}
|
||||||
Event::Tick => {
|
Event::Tick => {
|
||||||
app.update();
|
app.update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,8 @@ fn main() -> Result<(), failure::Error> {
|
||||||
.title_style(Style::default().fg(Color::Yellow).modifier(Modifier::Bold))
|
.title_style(Style::default().fg(Color::Yellow).modifier(Modifier::Bold))
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.border_style(Style::default().fg(Color::Magenta)),
|
.border_style(Style::default().fg(Color::Magenta)),
|
||||||
).render(&mut f, size);
|
)
|
||||||
|
.render(&mut f, size);
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let input = crossterm::input();
|
let input = crossterm::input();
|
||||||
|
|
|
@ -61,9 +61,11 @@ fn main() -> Result<(), failure::Error> {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
match events.next()? {
|
match events.next()? {
|
||||||
Event::Input(key) => if key == Key::Char('q') {
|
Event::Input(key) => {
|
||||||
|
if key == Key::Char('q') {
|
||||||
break;
|
break;
|
||||||
},
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,9 +199,11 @@ fn main() -> Result<(), failure::Error> {
|
||||||
app.selected -= 1
|
app.selected -= 1
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Key::Down => if app.selected < app.items.len() - 1 {
|
Key::Down => {
|
||||||
|
if app.selected < app.items.len() - 1 {
|
||||||
app.selected += 1;
|
app.selected += 1;
|
||||||
},
|
}
|
||||||
|
}
|
||||||
Key::Left => {
|
Key::Left => {
|
||||||
app.tabs.previous();
|
app.tabs.previous();
|
||||||
}
|
}
|
||||||
|
@ -256,7 +258,8 @@ where
|
||||||
Constraint::Length(7),
|
Constraint::Length(7),
|
||||||
]
|
]
|
||||||
.as_ref(),
|
.as_ref(),
|
||||||
).split(area);
|
)
|
||||||
|
.split(area);
|
||||||
draw_gauges(f, app, chunks[0]);
|
draw_gauges(f, app, chunks[0]);
|
||||||
draw_charts(f, app, chunks[1]);
|
draw_charts(f, app, chunks[1]);
|
||||||
draw_text(f, chunks[2]);
|
draw_text(f, chunks[2]);
|
||||||
|
@ -281,7 +284,8 @@ where
|
||||||
.fg(Color::Magenta)
|
.fg(Color::Magenta)
|
||||||
.bg(Color::Black)
|
.bg(Color::Black)
|
||||||
.modifier(Modifier::Italic),
|
.modifier(Modifier::Italic),
|
||||||
).label(&format!("{} / 100", app.progress))
|
)
|
||||||
|
.label(&format!("{} / 100", app.progress))
|
||||||
.percent(app.progress)
|
.percent(app.progress)
|
||||||
.render(f, chunks[0]);
|
.render(f, chunks[0]);
|
||||||
Sparkline::default()
|
Sparkline::default()
|
||||||
|
@ -349,7 +353,8 @@ where
|
||||||
.fg(Color::Black)
|
.fg(Color::Black)
|
||||||
.bg(Color::Green)
|
.bg(Color::Green)
|
||||||
.modifier(Modifier::Italic),
|
.modifier(Modifier::Italic),
|
||||||
).label_style(Style::default().fg(Color::Yellow))
|
)
|
||||||
|
.label_style(Style::default().fg(Color::Yellow))
|
||||||
.style(Style::default().fg(Color::Green))
|
.style(Style::default().fg(Color::Green))
|
||||||
.render(f, chunks[1]);
|
.render(f, chunks[1]);
|
||||||
}
|
}
|
||||||
|
@ -360,7 +365,8 @@ where
|
||||||
.title("Chart")
|
.title("Chart")
|
||||||
.title_style(Style::default().fg(Color::Cyan).modifier(Modifier::Bold))
|
.title_style(Style::default().fg(Color::Cyan).modifier(Modifier::Bold))
|
||||||
.borders(Borders::ALL),
|
.borders(Borders::ALL),
|
||||||
).x_axis(
|
)
|
||||||
|
.x_axis(
|
||||||
Axis::default()
|
Axis::default()
|
||||||
.title("X Axis")
|
.title("X Axis")
|
||||||
.style(Style::default().fg(Color::Gray))
|
.style(Style::default().fg(Color::Gray))
|
||||||
|
@ -371,14 +377,16 @@ where
|
||||||
&format!("{}", (app.window[0] + app.window[1]) / 2.0),
|
&format!("{}", (app.window[0] + app.window[1]) / 2.0),
|
||||||
&format!("{}", app.window[1]),
|
&format!("{}", app.window[1]),
|
||||||
]),
|
]),
|
||||||
).y_axis(
|
)
|
||||||
|
.y_axis(
|
||||||
Axis::default()
|
Axis::default()
|
||||||
.title("Y Axis")
|
.title("Y Axis")
|
||||||
.style(Style::default().fg(Color::Gray))
|
.style(Style::default().fg(Color::Gray))
|
||||||
.labels_style(Style::default().modifier(Modifier::Italic))
|
.labels_style(Style::default().modifier(Modifier::Italic))
|
||||||
.bounds([-20.0, 20.0])
|
.bounds([-20.0, 20.0])
|
||||||
.labels(&["-20", "0", "20"]),
|
.labels(&["-20", "0", "20"]),
|
||||||
).datasets(&[
|
)
|
||||||
|
.datasets(&[
|
||||||
Dataset::default()
|
Dataset::default()
|
||||||
.name("data2")
|
.name("data2")
|
||||||
.marker(Marker::Dot)
|
.marker(Marker::Dot)
|
||||||
|
@ -389,7 +397,8 @@ where
|
||||||
.marker(Marker::Braille)
|
.marker(Marker::Braille)
|
||||||
.style(Style::default().fg(Color::Yellow))
|
.style(Style::default().fg(Color::Yellow))
|
||||||
.data(&app.data3),
|
.data(&app.data3),
|
||||||
]).render(f, chunks[1]);
|
])
|
||||||
|
.render(f, chunks[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +429,8 @@ where
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.title("Footer")
|
.title("Footer")
|
||||||
.title_style(Style::default().fg(Color::Magenta).modifier(Modifier::Bold)),
|
.title_style(Style::default().fg(Color::Magenta).modifier(Modifier::Bold)),
|
||||||
).wrap(true)
|
)
|
||||||
|
.wrap(true)
|
||||||
.render(f, area);
|
.render(f, area);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,7 +486,8 @@ where
|
||||||
};
|
};
|
||||||
ctx.print(server.coords.1, server.coords.0, "X", color);
|
ctx.print(server.coords.1, server.coords.0, "X", color);
|
||||||
}
|
}
|
||||||
}).x_bounds([-180.0, 180.0])
|
})
|
||||||
|
.x_bounds([-180.0, 180.0])
|
||||||
.y_bounds([-90.0, 90.0])
|
.y_bounds([-90.0, 90.0])
|
||||||
.render(f, chunks[1]);
|
.render(f, chunks[1]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,8 @@ fn main() -> Result<(), failure::Error> {
|
||||||
Constraint::Percentage(25),
|
Constraint::Percentage(25),
|
||||||
]
|
]
|
||||||
.as_ref(),
|
.as_ref(),
|
||||||
).split(size);
|
)
|
||||||
|
.split(size);
|
||||||
|
|
||||||
Gauge::default()
|
Gauge::default()
|
||||||
.block(Block::default().title("Gauge1").borders(Borders::ALL))
|
.block(Block::default().title("Gauge1").borders(Borders::ALL))
|
||||||
|
@ -111,9 +112,11 @@ fn main() -> Result<(), failure::Error> {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
match events.next()? {
|
match events.next()? {
|
||||||
Event::Input(input) => if input == Key::Char('q') {
|
Event::Input(input) => {
|
||||||
|
if input == Key::Char('q') {
|
||||||
break;
|
break;
|
||||||
},
|
}
|
||||||
|
}
|
||||||
Event::Tick => {
|
Event::Tick => {
|
||||||
app.update();
|
app.update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,8 @@ fn main() -> Result<(), failure::Error> {
|
||||||
Constraint::Percentage(10),
|
Constraint::Percentage(10),
|
||||||
]
|
]
|
||||||
.as_ref(),
|
.as_ref(),
|
||||||
).split(size);
|
)
|
||||||
|
.split(size);
|
||||||
|
|
||||||
Block::default()
|
Block::default()
|
||||||
.title("Block")
|
.title("Block")
|
||||||
|
@ -59,9 +60,11 @@ fn main() -> Result<(), failure::Error> {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
match events.next()? {
|
match events.next()? {
|
||||||
Event::Input(input) => if let Key::Char('q') = input {
|
Event::Input(input) => {
|
||||||
|
if let Key::Char('q') = input {
|
||||||
break;
|
break;
|
||||||
},
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,8 @@ fn main() -> Result<(), failure::Error> {
|
||||||
Constraint::Percentage(30),
|
Constraint::Percentage(30),
|
||||||
]
|
]
|
||||||
.as_ref(),
|
.as_ref(),
|
||||||
).split(size);
|
)
|
||||||
|
.split(size);
|
||||||
|
|
||||||
let text = [
|
let text = [
|
||||||
Text::raw("This a line\n"),
|
Text::raw("This a line\n"),
|
||||||
|
@ -83,9 +84,11 @@ fn main() -> Result<(), failure::Error> {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
match events.next()? {
|
match events.next()? {
|
||||||
Event::Input(key) => if key == Key::Char('q') {
|
Event::Input(key) => {
|
||||||
|
if key == Key::Char('q') {
|
||||||
break;
|
break;
|
||||||
},
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,11 @@ fn main() -> Result<(), failure::Error> {
|
||||||
loop {
|
loop {
|
||||||
draw(&mut terminal)?;
|
draw(&mut terminal)?;
|
||||||
match terminal.backend().rustbox().poll_event(false) {
|
match terminal.backend().rustbox().poll_event(false) {
|
||||||
Ok(rustbox::Event::KeyEvent(key)) => if key == Key::Char('q') {
|
Ok(rustbox::Event::KeyEvent(key)) => {
|
||||||
|
if key == Key::Char('q') {
|
||||||
break;
|
break;
|
||||||
},
|
}
|
||||||
|
}
|
||||||
Err(e) => panic!("{}", e.description()),
|
Err(e) => panic!("{}", e.description()),
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
|
@ -41,6 +43,7 @@ fn draw(t: &mut Terminal<RustboxBackend>) -> Result<(), std::io::Error> {
|
||||||
.title_style(Style::default().fg(Color::Yellow).modifier(Modifier::Bold))
|
.title_style(Style::default().fg(Color::Yellow).modifier(Modifier::Bold))
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.border_style(Style::default().fg(Color::Magenta)),
|
.border_style(Style::default().fg(Color::Magenta)),
|
||||||
).render(&mut f, size)
|
)
|
||||||
|
.render(&mut f, size)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,13 +84,15 @@ fn main() -> Result<(), failure::Error> {
|
||||||
Constraint::Min(0),
|
Constraint::Min(0),
|
||||||
]
|
]
|
||||||
.as_ref(),
|
.as_ref(),
|
||||||
).split(size);
|
)
|
||||||
|
.split(size);
|
||||||
Sparkline::default()
|
Sparkline::default()
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
.title("Data1")
|
.title("Data1")
|
||||||
.borders(Borders::LEFT | Borders::RIGHT),
|
.borders(Borders::LEFT | Borders::RIGHT),
|
||||||
).data(&app.data1)
|
)
|
||||||
|
.data(&app.data1)
|
||||||
.style(Style::default().fg(Color::Yellow))
|
.style(Style::default().fg(Color::Yellow))
|
||||||
.render(&mut f, chunks[0]);
|
.render(&mut f, chunks[0]);
|
||||||
Sparkline::default()
|
Sparkline::default()
|
||||||
|
@ -98,7 +100,8 @@ fn main() -> Result<(), failure::Error> {
|
||||||
Block::default()
|
Block::default()
|
||||||
.title("Data2")
|
.title("Data2")
|
||||||
.borders(Borders::LEFT | Borders::RIGHT),
|
.borders(Borders::LEFT | Borders::RIGHT),
|
||||||
).data(&app.data2)
|
)
|
||||||
|
.data(&app.data2)
|
||||||
.style(Style::default().bg(Color::Green))
|
.style(Style::default().bg(Color::Green))
|
||||||
.render(&mut f, chunks[1]);
|
.render(&mut f, chunks[1]);
|
||||||
// Multiline
|
// Multiline
|
||||||
|
@ -107,15 +110,18 @@ fn main() -> Result<(), failure::Error> {
|
||||||
Block::default()
|
Block::default()
|
||||||
.title("Data3")
|
.title("Data3")
|
||||||
.borders(Borders::LEFT | Borders::RIGHT),
|
.borders(Borders::LEFT | Borders::RIGHT),
|
||||||
).data(&app.data3)
|
)
|
||||||
|
.data(&app.data3)
|
||||||
.style(Style::default().fg(Color::Red))
|
.style(Style::default().fg(Color::Red))
|
||||||
.render(&mut f, chunks[2]);
|
.render(&mut f, chunks[2]);
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
match events.next()? {
|
match events.next()? {
|
||||||
Event::Input(input) => if input == Key::Char('q') {
|
Event::Input(input) => {
|
||||||
|
if input == Key::Char('q') {
|
||||||
break;
|
break;
|
||||||
},
|
}
|
||||||
|
}
|
||||||
Event::Tick => {
|
Event::Tick => {
|
||||||
app.update();
|
app.update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,11 +91,13 @@ fn main() -> Result<(), failure::Error> {
|
||||||
app.selected = 0;
|
app.selected = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Key::Up => if app.selected > 0 {
|
Key::Up => {
|
||||||
|
if app.selected > 0 {
|
||||||
app.selected -= 1;
|
app.selected -= 1;
|
||||||
} else {
|
} else {
|
||||||
app.selected = app.items.len() - 1;
|
app.selected = app.items.len() - 1;
|
||||||
},
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
|
@ -379,7 +379,8 @@ fn test_rect_size_truncation() {
|
||||||
// but let's make sure the ratios don't diverge crazily.
|
// but let's make sure the ratios don't diverge crazily.
|
||||||
assert!(
|
assert!(
|
||||||
(f64::from(rect.width) / f64::from(rect.height)
|
(f64::from(rect.width) / f64::from(rect.height)
|
||||||
- f64::from(width) / f64::from(height)).abs()
|
- f64::from(width) / f64::from(height))
|
||||||
|
.abs()
|
||||||
< 1.0
|
< 1.0
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,8 @@ impl<'a> Widget for BarChart<'a> {
|
||||||
buf.get_mut(
|
buf.get_mut(
|
||||||
chart_area.left() + i as u16 * (self.bar_width + self.bar_gap) + x,
|
chart_area.left() + i as u16 * (self.bar_width + self.bar_gap) + x,
|
||||||
chart_area.top() + j,
|
chart_area.top() + j,
|
||||||
).set_symbol(symbol)
|
)
|
||||||
|
.set_symbol(symbol)
|
||||||
.set_style(self.style);
|
.set_style(self.style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -428,7 +428,8 @@ where
|
||||||
|
|
||||||
for dataset in self.datasets {
|
for dataset in self.datasets {
|
||||||
match dataset.marker {
|
match dataset.marker {
|
||||||
Marker::Dot => for &(x, y) in dataset.data.iter().filter(|&&(x, y)| {
|
Marker::Dot => {
|
||||||
|
for &(x, y) in dataset.data.iter().filter(|&&(x, y)| {
|
||||||
!(x < self.x_axis.bounds[0]
|
!(x < self.x_axis.bounds[0]
|
||||||
|| x > self.x_axis.bounds[1]
|
|| x > self.x_axis.bounds[1]
|
||||||
|| y < self.y_axis.bounds[0]
|
|| y < self.y_axis.bounds[0]
|
||||||
|
@ -445,7 +446,8 @@ where
|
||||||
.set_symbol(symbols::DOT)
|
.set_symbol(symbols::DOT)
|
||||||
.set_fg(dataset.style.fg)
|
.set_fg(dataset.style.fg)
|
||||||
.set_bg(dataset.style.bg);
|
.set_bg(dataset.style.bg);
|
||||||
},
|
}
|
||||||
|
}
|
||||||
Marker::Braille => {
|
Marker::Braille => {
|
||||||
Canvas::default()
|
Canvas::default()
|
||||||
.background_color(self.style.bg)
|
.background_color(self.style.bg)
|
||||||
|
@ -456,7 +458,8 @@ where
|
||||||
coords: dataset.data,
|
coords: dataset.data,
|
||||||
color: dataset.style.fg,
|
color: dataset.style.fg,
|
||||||
});
|
});
|
||||||
}).draw(graph_area, buf);
|
})
|
||||||
|
.draw(graph_area, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,7 +236,8 @@ impl<'b> Widget for SelectableList<'b> {
|
||||||
} else {
|
} else {
|
||||||
Text::styled(item, self.style)
|
Text::styled(item, self.style)
|
||||||
}
|
}
|
||||||
}).skip(offset as usize);
|
})
|
||||||
|
.skip(offset as usize);
|
||||||
List::new(items)
|
List::new(items)
|
||||||
.block(self.block.unwrap_or_default())
|
.block(self.block.unwrap_or_default())
|
||||||
.style(self.style)
|
.style(self.style)
|
||||||
|
|
|
@ -27,7 +27,8 @@ fn it_draws_a_block() {
|
||||||
height: 8,
|
height: 8,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}).unwrap();
|
})
|
||||||
|
.unwrap();
|
||||||
let mut expected = Buffer::with_lines(vec![
|
let mut expected = Buffer::with_lines(vec![
|
||||||
"┌Title─┐ ",
|
"┌Title─┐ ",
|
||||||
"│ │ ",
|
"│ │ ",
|
||||||
|
|
|
@ -28,7 +28,8 @@ fn gauge_render() {
|
||||||
.block(Block::default().title("Ratio").borders(Borders::ALL))
|
.block(Block::default().title("Ratio").borders(Borders::ALL))
|
||||||
.ratio(0.2113139343131)
|
.ratio(0.2113139343131)
|
||||||
.render(&mut f, chunks[1]);
|
.render(&mut f, chunks[1]);
|
||||||
}).unwrap();
|
})
|
||||||
|
.unwrap();
|
||||||
let expected = Buffer::with_lines(vec![
|
let expected = Buffer::with_lines(vec![
|
||||||
" ",
|
" ",
|
||||||
" ",
|
" ",
|
||||||
|
|
Loading…
Reference in a new issue