Skip to content

ITextLineExtent interface

Contract of a control that presents a text document through the extension pipeline.

A whole document line’s coordinates, answered from the line’s own estimate without laying it out. Speaks source offsets and x only: columns belong to a laid-out slice, and a line long enough to be sliced has no columns of its own until one is built.

public interface ITextLineExtent
name description
IsExact { get; } Whether the mappings are measured rather than estimated, which they are only where every character of the line advances the same amount.
SourceLength { get; } Length of the line’s text, excluding its delimiter.
SourceOffset { get; } Document offset the line starts at.
Width { get; } Width of the whole line, equal to GetXForOffset at its end.
GetOffsetForX(…) Line-relative source offset at a distance from the line’s left edge, rounded down and clamped into the line.
GetXForOffset(…) Distance from the line’s left edge to a line-relative source offset, which is clamped into the line.

The mapping keeps the width it was built with for as long as the line lives, so a slice laid out later does not move sideways as the view refines its estimates. Width can therefore differ from ExtentWidth. A document change invalidates the extent, so callers ask for it again rather than holding one.