Skip to content

fix: do not render progress bar on AddDetail when visibility is false (fixes #236) - #237

Open
tonycoder-hub wants to merge 1 commit into
schollz:mainfrom
tonycoder-hub:codex-oss/oss-hv-pr-500-v1/fix-progressbar-issue236
Open

fix: do not render progress bar on AddDetail when visibility is false (fixes #236)#237
tonycoder-hub wants to merge 1 commit into
schollz:mainfrom
tonycoder-hub:codex-oss/oss-hv-pr-500-v1/fix-progressbar-issue236

Conversation

@tonycoder-hub

Copy link
Copy Markdown

Summary

Fixes #236

When a progress bar is created with OptionSetVisibility(false), calling AddDetail(detail) immediately calls p.render(). Because render() previously lacked a check for p.config.invisible, it bypassed the visibility setting and rendered ANSI progress bar escape codes and output to the configured writer.

Changes

  • Added an early return check if p.config.invisible { return nil } at the start of render(). This ensures that all render paths respect the invisible setting.
  • Added regression unit test TestInvisibleWithAddDetail in progressbar_test.go verifying that no bytes are output when AddDetail is invoked on an invisible progress bar.
  • Verified that all existing tests pass with zero regressions.

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