Table of Contents

Class MarkupSpinnerClock

Namespace
SharpConsoleUI.Parsing
Assembly
SharpConsoleUI.dll

Static, monotonic-time-driven frame source for inline [spinner] markup tags. The current frame is computed purely from elapsed time, so reading is allocation-free and requires no per-frame registration. Reserved width per style is constant, so inline spinners never cause text reflow. IsActive keeps the render loop repainting while inline spinners are on screen.

public static class MarkupSpinnerClock
Inheritance
MarkupSpinnerClock
Inherited Members

Properties

IsActive

True if an inline spinner was parsed within the keep-alive window.

public static bool IsActive { get; }

Property Value

bool

Methods

CurrentFrame(SpinnerStyle)

Current 0-based frame index using the style's per-style default interval.

public static int CurrentFrame(SpinnerStyle style)

Parameters

style SpinnerStyle

Returns

int

CurrentFrame(SpinnerStyle, int)

Current 0-based frame index for a style at the given interval, derived from elapsed monotonic time.

public static int CurrentFrame(SpinnerStyle style, int intervalMs)

Parameters

style SpinnerStyle
intervalMs int

Returns

int

CurrentGlyph(SpinnerStyle)

Current frame glyph using the style's per-style default interval.

public static string CurrentGlyph(SpinnerStyle style)

Parameters

style SpinnerStyle

Returns

string

CurrentGlyph(SpinnerStyle, int)

Current frame glyph for a style at the given interval, right-padded to the style's natural reserved width.

public static string CurrentGlyph(SpinnerStyle style, int intervalMs)

Parameters

style SpinnerStyle
intervalMs int

Returns

string

CurrentGlyph(SpinnerStyle, int, int)

Current frame glyph for a style at the given interval, right-padded to its reserved width. requestedWidth sets an explicit minimum field width (clamped up to the natural width so the glyph never clips); a non-positive value uses the natural width.

public static string CurrentGlyph(SpinnerStyle style, int intervalMs, int requestedWidth)

Parameters

style SpinnerStyle
intervalMs int
requestedWidth int

Returns

string

MarkParsedForTests()

Test-only: public wrapper around SharpConsoleUI.Parsing.MarkupSpinnerClock.MarkParsed().

public static void MarkParsedForTests()

ReservedWidth(SpinnerStyle)

Constant reserved column width for a style = max display width across its frames.

public static int ReservedWidth(SpinnerStyle style)

Parameters

style SpinnerStyle

Returns

int

ReservedWidth(SpinnerStyle, int)

Reserved column width for a style honoring an explicit minimum requestedWidth (e.g. from a [spinner … width:N] tag). The request is a minimum: a value narrower than the style's natural width is clamped up so the glyph never clips. A non-positive request means "use the natural width".

public static int ReservedWidth(SpinnerStyle style, int requestedWidth)

Parameters

style SpinnerStyle
requestedWidth int

Returns

int

ResetForTests()

Test-only: resets the keep-alive tick so IsActive returns false until the next MarkParsed.

public static void ResetForTests()

ResetTimeProviderForTests()

Test-only: restores the default monotonic time source.

public static void ResetTimeProviderForTests()

SetTimeProviderForTests(Func<long>)

Test-only: overrides the time source.

public static void SetTimeProviderForTests(Func<long> now)

Parameters

now Func<long>

ShouldKeepRendering(bool)

Whether the render loop should keep repainting for inline spinners. True only when animations are enabled AND an inline spinner is active.

public static bool ShouldKeepRendering(bool animationsEnabled)

Parameters

animationsEnabled bool

Returns

bool