Skip to content

Commit

Permalink
Make ProgressBar:set_tab_with take &self
Browse files Browse the repository at this point in the history
  • Loading branch information
jaheba authored and djc committed Jan 16, 2025
1 parent fff1218 commit 1a5f606
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/progress_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl ProgressBar {
}

/// Sets the tab width (default: 8). All tabs will be expanded to this many spaces.
pub fn set_tab_width(&mut self, tab_width: usize) {
pub fn set_tab_width(&self, tab_width: usize) {
let mut state = self.state();
state.set_tab_width(tab_width);
state.draw(true, Instant::now()).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions tests/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ fn basic_tab_expansion() {
let mp =
MultiProgress::with_draw_target(ProgressDrawTarget::term_like(Box::new(in_mem.clone())));

let mut spinner = mp.add(ProgressBar::new_spinner().with_message("Test\t:)"));
let spinner = mp.add(ProgressBar::new_spinner().with_message("Test\t:)"));
spinner.tick();

// 8 is the default number of spaces
Expand All @@ -753,7 +753,7 @@ fn tab_expansion_in_template() {
let mp =
MultiProgress::with_draw_target(ProgressDrawTarget::term_like(Box::new(in_mem.clone())));

let mut spinner = mp.add(
let spinner = mp.add(
ProgressBar::new_spinner()
.with_message("Test\t:)")
.with_prefix("Pre\tfix!")
Expand Down

0 comments on commit 1a5f606

Please sign in to comment.