Namespace SharpConsoleUI.Helpers
Classes
- BrailleHelpers
Shared static helpers for pixel-grid braille rendering. Provides Bresenham's line algorithm and braille character mapping for controls that render using Unicode Braille patterns (U+2800 block).
- ClipboardHelper
Cross-platform clipboard helper for console applications. On Linux tries wl-clipboard, xclip, xsel. Falls back to an in-process buffer when no external tool is available. Operations are best-effort and will not throw on failure.
- ColorBlendHelper
Shared color blending utilities used by flash overlay, fade animations, and other effects. Extracted to avoid code duplication between WindowStateService and WindowAnimations.
- ColorGradient
Helper for creating and interpolating smooth color gradients. Supports predefined gradients (cool, warm, spectrum, grayscale) and custom gradients.
- ColorResolver
Provides centralized color resolution logic for controls. Resolution chain: explicit value → theme slot → Color.Transparent. null and Color.Default are treated identically (both mean "no explicit value").
- ContentHelper
Provides helper methods for content layout and positioning calculations.
- ControlRenderingHelpers
Shared rendering utilities for controls to avoid code duplication. Pass Transparent as
backgroundto preserve whatever is already in the buffer (gradient, parent background, etc.).
- ExceptionFormatter
Writes ANSI-colored exception output to a TextWriter, replacing Spectre.Console's AnsiConsole.WriteException with zero external dependencies. Intended for crash-time reporting after Console.Clear().
- GeometryHelpers
Provides static helper methods for Rectangle geometry operations. Extracted from ConsoleWindowSystem as part of Phase 3.1 refactoring. Consolidates duplicate geometry logic from multiple classes.
- PropertySetterHelper
Helper class for property setters with validation and invalidation. Eliminates 200-250 lines of duplicated Width/Height/Color property patterns across 14+ controls.
- ScrollbarHelper
Shared scrollbar geometry, drawing, and hit testing logic. Used by ListControl, TreeControl, and TableControl.
- ScrollingHelper
Helper class for managing viewport scrolling logic across scrollable controls. Consolidates duplicated scroll adjustment code from TreeControl, ListControl, and DropdownControl.
- SelectionStateHelper
Helper class for managing selection state updates across controls. Eliminates code duplication and prevents double event firing bugs.
- SequenceHelper
Provides helper methods and constants for handling ANSI escape sequences, mouse input parsing, and keyboard input processing in console applications.
- Size
Represents a size with width and height dimensions.
- SliderRenderingHelper
Shared rendering and math utilities for SliderControl and RangeSliderControl. Eliminates code duplication between the two slider implementations.
- StringBuilderExtensions
Extension methods for StringBuilder to support Rune (supplementary plane) characters.
- StringHelper
Provides helper methods for string manipulation operations.
- TerminalCapabilities
Detects terminal rendering capabilities at runtime. Probed once during driver initialization; results are cached for the session.
- TextMeasurementCache
Caches expensive text measurement operations for improved rendering performance. Eliminates duplicate measurements during rendering cycles (40+ calls per frame in complex controls).
- TextTruncationHelper
Helper class for truncating text with ellipsis, handling Spectre.Console markup correctly. Consolidates 85% similar truncation logic from 4+ locations.
- ThreadSafeStringBuilder
Provides a thread-safe wrapper around StringBuilder for concurrent string building operations.
- UnicodeWidth
Provides display width information for Unicode characters. Delegates to the Wcwidth library for accurate width calculation including zero-width characters (combining marks, variation selectors, ZWJ). Spacing Combining Marks (Unicode category Mc) are corrected to width 1, as they occupy visual space in terminals despite Wcwidth marking them zero-width. Adapts to terminal capabilities: uses Unicode 15.0 width tables unless the terminal is detected to support Unicode 16.0 widths (probed at startup).
- WordBoundaryHelper
Provides word boundary detection for text navigation and editing. Word characters: letters, digits, underscores. Everything else is a separator.
Enums
- ClipboardBackend
Identifies the clipboard backend in use.
- KeyCode
The KeyCode enumeration encodes key information from console drivers and provides a consistent way for application code to specify keys and receive key events.
- ScrollbarHitZone
Identifies which part of a scrollbar was hit by a click.