Skip to content

AddDetail renders the bar even when OptionSetVisibility(false) - #247

Open
tsuyukidev wants to merge 1 commit into
schollz:mainfrom
tsuyukidev:fix/add-detail-invisible
Open

tsuyukidev wants to merge 1 commit into
schollz:mainfrom
tsuyukidev:fix/add-detail-invisible

Conversation

@tsuyukidev

Copy link
Copy Markdown

Fixes #236.

AddDetail calls render() when it records the first detail, without checking config.invisible. Every other render entry point checks it first (Add64, Describe, RenderBlank, renderDetails), so an invisible bar stays quiet right up until the first AddDetail, which then paints a line:

bar := progressbar.NewOptions64(100,
    progressbar.OptionSetVisibility(false),
    progressbar.OptionSetMaxDetailRow(2),
)
bar.Add(10)        // no output
bar.AddDetail("x") // renders a 0% bar

Guarding the initial render with !p.config.invisible matches the surrounding methods. renderDetails() already returns early when invisible, so the rest of the path was fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AddDetail cause progressbar to render even when visible is false

1 participant