You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
On Windows, the progress bar flickers significantly during updates. This does not happen on Unix-like systems, and appears to be a platform-specific issue related to how carriage return (\r) is handled in the Windows console environment.
Reproduction Steps:
Run any basic example (e.g., progressbar.Default(...)) under Windows Terminal or PowerShell (pwsh)
Observe the progress bar while it's rendering
Flickering or line flashing occurs throughout the update
Expected Behavior:
Smooth, frame-consistent progress updates (similar to behavior under Unix/Linux terminals).
Actual Behavior:
The progress bar flickers, with visible artifacts and inconsistent frame stability during each render pass.
Root Cause:
The issue lies in the clearProgressBar function (progressbar.go, lines ~1365–1380):
This approach emits multiple \r characters and overwrites the entire line with whitespace, then repositions again using \r. While this works on ANSI-based Unix terminals, Windows consoles do not always handle \r symmetrically, especially under the ConPTY layer (used by Windows Terminal and pwsh), which leads to flickering.
Technical Explanation:
Category
Unix/Linux
Windows
Terminal model
VT100-style
ConPTY / Win32 Console
\r behavior
Resets to line start
May cause partial line redraw
Buffering
Line-buffered + direct ANSI rendering
Double-buffered with scroll regions
Consequence
Clean redraw
Visual artifact due to redraw mismatch
Proposed Fix:
Use ANSI clear-line sequence (\033[2K\r) instead of redundant space overwrite when ANSI mode is enabled, and fallback to minimal \r if on Windows:
Description:
On Windows, the progress bar flickers significantly during updates. This does not happen on Unix-like systems, and appears to be a platform-specific issue related to how carriage return (
\r) is handled in the Windows console environment.Reproduction Steps:
progressbar.Default(...)) under Windows Terminal or PowerShell (pwsh)Expected Behavior:
Smooth, frame-consistent progress updates (similar to behavior under Unix/Linux terminals).
Actual Behavior:
The progress bar flickers, with visible artifacts and inconsistent frame stability during each render pass.
Root Cause:
The issue lies in the
clearProgressBarfunction (progressbar.go, lines ~1365–1380):This approach emits multiple
\rcharacters and overwrites the entire line with whitespace, then repositions again using\r. While this works on ANSI-based Unix terminals, Windows consoles do not always handle\rsymmetrically, especially under the ConPTY layer (used by Windows Terminal and pwsh), which leads to flickering.Technical Explanation:
\rbehaviorProposed Fix:
Use ANSI clear-line sequence (
\033[2K\r) instead of redundant space overwrite when ANSI mode is enabled, and fallback to minimal\rif on Windows:This improves compatibility without changing behavior on Unix-like systems, and significantly reduces flicker under Windows Terminal environments.
Comparison Video:
progressbar_flick_10mb.mp4