Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra whitespace in the battery bar #11

Closed
grtcdr opened this issue Feb 17, 2021 · 0 comments
Closed

Extra whitespace in the battery bar #11

grtcdr opened this issue Feb 17, 2021 · 0 comments
Assignees

Comments

@grtcdr
Copy link
Member

grtcdr commented Feb 17, 2021

Status

Resolved: commit 6246d63 seems to have fixed this bug.
EDIT: Nevermind that, the bug still persists.
EDIT 2: commit 805c0b8 should fix this issue.
EDIT 3: the bug still persits, but the reason this bug happens is now clear.
EDIT 4: The bug is gone! (e871ae8)

Description

macchina --bar shows an extra whitespace at the end of the battery bar before the closing bracket.

Reproducible

Yes

Reason

/// Return the correct amount of colored blocks: colored blocks are used blocks
pub fn colored_blocks(elems: &Elements, block_count: usize) -> ColoredString {
    let colored_blocks = elems.format.bar_glyph.repeat(block_count);
    colored_blocks
        .chars()
        .collect::<Vec<char>>()
        .chunks(1)
        .map(|c| c.iter().collect::<String>())
        .collect::<Vec<String>>()
        .join(" ")
        .color(elems.format.color)
}

This function is meant to split up the amount of blocks into chunks, add a space between them, color and return them. but, whenever the block_count is equal to 10, it adds an extra space!

@grtcdr grtcdr added the bug label Feb 17, 2021
@grtcdr grtcdr self-assigned this Feb 17, 2021
@grtcdr grtcdr closed this as completed Feb 19, 2021
@grtcdr grtcdr reopened this Feb 20, 2021
@grtcdr grtcdr closed this as completed Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant