Class ScrollState
- Namespace
- MiniTui
- Assembly
- MiniTui.dll
The scroll position of scrollable text, such as a ParagraphBuilder or a modal. The widget writes ViewportHeight and ContentHeight and clamps Offset while drawing.
public sealed class ScrollState
- Inheritance
-
ScrollState
- Inherited Members
Properties
ContentHeight
How many rows the content had at the last draw.
public int ContentHeight { get; }
Property Value
HasSelection
True while something is selected.
public bool HasSelection { get; }
Property Value
Offset
The first visible row. Clamped when drawn.
public int Offset { get; set; }
Property Value
Selectable
Let the mouse select the text (1.x spec §20.5): a press and drag select, a double-click a word, a triple-click a row. Ctrl+C and Ctrl+Insert copy, Ctrl+A selects all and Esc clears. Off by default.
public bool Selectable { get; set; }
Property Value
SelectedText
The selected part of each row as it was drawn last, with a line break between rows.
public string SelectedText { get; }
Property Value
ViewportHeight
How many rows were visible at the last draw.
public int ViewportHeight { get; }
Property Value
Methods
ClearSelection()
Clear the selection.
public void ClearSelection()
Copy()
Copy the selection to the Clipboard.
public bool Copy()
Returns
- bool
False, doing nothing, without a selection.
HandleKey(ConsoleKeyInfo)
Handle ↑ ↓ j k PgUp PgDn Home End; when Selectable, also Ctrl+C and Ctrl+Insert (copy, with a selection), Ctrl+A (select all) and Esc (clear a selection).
public bool HandleKey(ConsoleKeyInfo key)
Parameters
keyConsoleKeyInfo
Returns
- bool
True if the key was handled.
HandleMouse(MouseEvent)
Handle the mouse over the text drawn last (1.x spec §4.8, §14.4): the wheel scrolls by three rows, the scrollbar's thumb drags and its track pages. When Selectable, the left button selects (§20.5).
public bool HandleMouse(MouseEvent mouse)
Parameters
mouseMouseEvent
Returns
- bool
True if it scrolled, tried to, or selected.
ScrollBy(int)
Scroll by rows (negative scrolls up).
public void ScrollBy(int rows)
Parameters
rowsint
SelectAll()
Select every row drawn last.
public void SelectAll()