Table of Contents

Interface IGutterRenderer

Namespace
SharpConsoleUI.Controls
Assembly
SharpConsoleUI.dll

Defines a pluggable gutter renderer for MultilineEditControl. Multiple renderers are stacked left-to-right in the gutter area.

public interface IGutterRenderer
Extension Methods

Methods

GetWidth(int)

Returns the width in columns that this renderer needs for the given document. Called once per paint pass; the sum of all renderer widths determines the total gutter width.

int GetWidth(int totalLineCount)

Parameters

totalLineCount int

The total number of source lines in the document.

Returns

int

Render(in GutterRenderContext, int)

Renders a single row of the gutter.

void Render(in GutterRenderContext context, int width)

Parameters

context GutterRenderContext

The rendering context for this row.

width int

The column width allocated to this renderer (from GetWidth(int)).

Events

Invalidated

Raised when the renderer's state changes after it has been attached to a MultilineEditControl (e.g. git-diff markers or breakpoints updated at runtime) so the host editor redraws. Just signal that something changed — the editor decides the invalidation level itself by re-querying GetWidth(int): if the gutter's total width changed the text reflows (a relayout), otherwise it is a paint-only redraw. The renderer does NOT (and must not) decide the level — that keeps the layout decision in the one place that owns it, derived from GetWidth(int).

event EventHandler? Invalidated

Event Type

EventHandler

Remarks

Raising this replaces any manual editor.Container?.Invalidate(...) the consumer used to call after mutating the renderer. A renderer whose state never changes after construction (e.g. the built-in line-number renderer) simply never raises it.