Skip to content

Rendering in two colors causes inconsistent color of the cur character #718

@Finomnis

Description

@Finomnis

Running Windows 11 with indicatif 0.18.0.

The following code reproduces the problem:

use indicatif::{ProgressBar, ProgressStyle};

fn main() {
    let bar = ProgressBar::new(100)
        .with_style(ProgressStyle::with_template("{bar:10.red/blue}").unwrap());
    bar.inc(25);
    std::process::exit(0);
}

Result:

Image

Expected:

Image

Bug hunt

The incorrectly colored character seems to be caused by cur being set to 1, rendering the 'not filled' character here.

The solution would be to color the cur character properly if it is the 'not filled' character.

I'm not sure how to implement this change because the code structure makes this really hard to solve without hacky workarounds. It simply doesn't seem to be intended that the cur character gets colored.

On the other hand, the cur character seems to be required because otherwise the progress bar gets one too short.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions