Skip to content

ITerminalReflowProvider

Namespace: Hex1b.Reflow

Assembly: Hex1b.dll

Opt-in interface that presentation adapters can implement to provide terminal-emulator-specific reflow behavior during resize operations.

csharp
public interface ITerminalReflowProvider

Properties

ReflowEnabled

Gets whether reflow is enabled. When false, the terminal uses standard crop-and-extend resize behavior even though the adapter implements this interface. Defaults to true.

Returns: Boolean

csharp
bool ReflowEnabled { get; }

ShouldClearSoftWrapOnAbsolutePosition

Gets whether absolute cursor positioning (CUP, HVP) should clear the flag on the current row's last cell.

Returns: Boolean

csharp
bool ShouldClearSoftWrapOnAbsolutePosition { get; }

Methods

Reflow(ReflowContext)

Performs reflow of terminal content during a resize operation.

Parameters:

  • context (ReflowContext): The current terminal state including screen buffer, scrollback, and cursor position.

Returns: ReflowResult

The reflowed terminal state with new buffer, scrollback, and cursor position.

csharp
ReflowResult Reflow(ReflowContext context)

Remarks

When resizes, it checks if its presentation adapter implements this interface. If so, it calls with the current buffer state and applies the returned result. If the adapter does not implement this interface, the terminal falls back to simple crop-and-extend behavior.

Different terminal emulators (xterm, kitty, alacritty) handle reflow differently. The adapter controls the reflow algorithm — is fully decoupled from how reflow works.

Pre-built strategies are available for adapters to delegate to.

Released under the MIT License.