refactor(widgets/gauge): stop using unicode blocks by default

pull/423/head
Florian Dehau 4 years ago
parent 0a05579a1c
commit 79e27b1778

@ -107,7 +107,7 @@ fn main() -> Result<(), Box<dyn Error>> {
) )
.percent(app.progress4) .percent(app.progress4)
.label(label) .label(label)
.use_unicode(false); .use_unicode(true);
f.render_widget(gauge, chunks[3]); f.render_widget(gauge, chunks[3]);
})?; })?;

@ -35,7 +35,7 @@ impl<'a> Default for Gauge<'a> {
block: None, block: None,
ratio: 0.0, ratio: 0.0,
label: None, label: None,
use_unicode: true, use_unicode: false,
style: Style::default(), style: Style::default(),
gauge_style: Style::default(), gauge_style: Style::default(),
} }
@ -168,6 +168,7 @@ fn get_unicode_block<'a>(frac: f64) -> &'a str {
_ => " ", _ => " ",
} }
} }
/// A compact widget to display a task progress over a single line. /// A compact widget to display a task progress over a single line.
/// ///
/// # Examples: /// # Examples:

@ -23,11 +23,13 @@ fn widgets_gauge_renders() {
let gauge = Gauge::default() let gauge = Gauge::default()
.block(Block::default().title("Percentage").borders(Borders::ALL)) .block(Block::default().title("Percentage").borders(Borders::ALL))
.gauge_style(Style::default().bg(Color::Blue).fg(Color::Red)) .gauge_style(Style::default().bg(Color::Blue).fg(Color::Red))
.use_unicode(true)
.percent(43); .percent(43);
f.render_widget(gauge, chunks[0]); f.render_widget(gauge, chunks[0]);
let gauge = Gauge::default() let gauge = Gauge::default()
.block(Block::default().title("Ratio").borders(Borders::ALL)) .block(Block::default().title("Ratio").borders(Borders::ALL))
.gauge_style(Style::default().bg(Color::Blue).fg(Color::Red)) .gauge_style(Style::default().bg(Color::Blue).fg(Color::Red))
.use_unicode(true)
.ratio(0.511_313_934_313_1); .ratio(0.511_313_934_313_1);
f.render_widget(gauge, chunks[1]); f.render_widget(gauge, chunks[1]);
}) })

Loading…
Cancel
Save