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

This commit is contained in:
Florian Dehau 2020-11-29 19:27:34 +01:00
parent 0a05579a1c
commit 79e27b1778
3 changed files with 5 additions and 2 deletions

View file

@ -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]);
})?;

View file

@ -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:

View file

@ -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]);
})