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)
.label(label)
.use_unicode(false);
.use_unicode(true);
f.render_widget(gauge, chunks[3]);
})?;

@ -35,7 +35,7 @@ impl<'a> Default for Gauge<'a> {
block: None,
ratio: 0.0,
label: None,
use_unicode: true,
use_unicode: false,
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.
///
/// # Examples:

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

Loading…
Cancel
Save