Generated by AurionDocs
Job ID: 934f8c39-8082-4942-8d17-72ed8f5f8d50
Source commit: 40aea9a
1.3 KiB
RenderHelpers
File:
src/EchoHub.Client/UI/Chat/RenderHelpers.cs
Kind: class
static class RenderHelpers
RenderHelpers is a small static utility class that centralizes rendering concerns for IListDataSource implementations. It currently provides a single method, WriteText, which writes text to a ListView grapheme by grapheme, respecting a maximum width. It returns the updated drawn-columns count, enabling callers to track horizontal placement as multiple fields are rendered on a single line.
Remarks
RenderHelpers abstracts the grapheme-aware rendering logic so all list-rendering code shares the same boundary checks and column accounting. It couples the GraphemeHelper.GetGraphemes iteration with a safe width calculation, reducing the chance of off-by-one errors when composing UI rows. In short, it’s the single place responsible for safe, width-bound text rendering to a ListView in this UI layer.
Notes
- The width of each grapheme is determined by
grapheme.GetColumns(), clamped to at least 1 withMath.Max(grapheme.GetColumns(), 1). - Rendering stops when adding the next grapheme would exceed
maxWidth; partial graphemes are not drawn. - The method delegates actual drawing to
ListView.AddStr, so callers should ensure theListViewstate is appropriate for incremental writes.