Table of Contents

Class SplitState

Namespace
MiniTui
Assembly
MiniTui.dll

The divider position of a split (1.x spec §14.3), drawn with Split(SplitState). The panes are sized by Ratio, so they keep their proportions when the terminal is resized, or with one pane at a fixed size in cells (FixedSize, a sidebar), the other taking the rest. The user drags the divider, or moves it with Alt+Shift and the arrows.

public sealed class SplitState
Inheritance
SplitState
Inherited Members

Constructors

SplitState(Direction, double)

A split sized by ratio.

public SplitState(Direction direction, double ratio = 0.5)

Parameters

direction Direction

How the panes are laid out: Horizontal side by side (a │ divider), Vertical one above the other (a ─ divider).

ratio double

The first pane's share of the space, from 0 to 1.

Properties

Direction

How the panes are laid out.

public Direction Direction { get; }

Property Value

Direction

FixedPane

Which pane FixedSize applies to. Default First.

public SplitPane FixedPane { get; set; }

Property Value

SplitPane

FixedSize

The FixedPane's size in cells, or null to size by Ratio. Clamped to 0 or more when set.

public int? FixedSize { get; set; }

Property Value

int?

IsDragging

True from a left press on the divider until the release.

public bool IsDragging { get; }

Property Value

bool

MinFirst

The smallest size, in cells, the user can drag the first pane to. Default 3. If the area is too small for both minimums, they're ignored.

public int MinFirst { get; set; }

Property Value

int

MinSecond

The smallest size, in cells, the user can drag the second pane to. Default 3.

public int MinSecond { get; set; }

Property Value

int

Ratio

The first pane's share of the space (the area minus the divider), from 0 to 1, when FixedSize is null. Clamped to 0–1 when set.

public double Ratio { get; set; }

Property Value

double

Methods

Fixed(Direction, int, SplitPane)

A split with pane fixed at cells.

public static SplitState Fixed(Direction direction, int cells, SplitPane pane = SplitPane.First)

Parameters

direction Direction
cells int
pane SplitPane

Returns

SplitState

HandleKey(ConsoleKeyInfo)

Alt+Shift+← → (side by side) or Alt+Shift+↑ ↓ (one above the other) move the divider a cell.

public bool HandleKey(ConsoleKeyInfo key)

Parameters

key ConsoleKeyInfo

Returns

bool

True if the key was one of these.

HandleMouse(MouseEvent)

A left press on the divider from the last draw starts a drag; drags move the divider under the pointer, wherever it is; the release, or a press anywhere else, ends it.

public bool HandleMouse(MouseEvent mouse)

Parameters

mouse MouseEvent

Returns

bool

True if the event was for the divider.

MoveBy(int)

Move the divider by cells (negative: left or up), within the minimums, using the area from the last draw. Does nothing before the first draw.

public void MoveBy(int cells)

Parameters

cells int

Events

Changed

Raised on the UI thread when the user moves the divider (not when code sets Ratio or FixedSize).

public event EventHandler? Changed

Event Type

EventHandler