Skip to content

Commit

Permalink
refactor(widgets/gauge): stop using unicode blocks by default
Browse files Browse the repository at this point in the history
  • Loading branch information
fdehau authored and 24seconds committed Nov 30, 2020
1 parent 9c80a10 commit a491fc8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/gauge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
})?;

Expand Down
3 changes: 2 additions & 1 deletion src/widgets/gauge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions tests/widgets_gauge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
})
Expand Down

0 comments on commit a491fc8

Please sign in to comment.