TerminalFrame
class in package klyn.gui.terminal

    public class TerminalFrame extends Object:

Object
└ TerminalFrame

Logical terminal frame backed by styled cells.

The frame is independent from ANSI escape sequences and can be inspected by tests before being flushed to the real terminal.

Coordinates are 0-based.

Fields

Modifier and Type | Member | Description
--- | --- | ---
public | cursorCol `cursorCol as Int = 0` | No summary.
public | cursorRow `cursorRow as Int = 0` | No summary.
public | cursorVisible `cursorVisible as Boolean = false` | No summary.

Properties

Modifier and Type | Member | Description
--- | --- | ---
public readonly property | height `height as Int:` | No summary.
public readonly property | width `width as Int:` | No summary.

Inherited Properties
property Inherited Properties from Object: type
Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | TerminalFrame `TerminalFrame(width as Int, height as Int, defaultStyle as RenderStyle = null):` | Builds a frame filled with spaces using the provided default style.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public | cell `cell(row as Int, col as Int) as RenderCell:` | Returns the cell at the given coordinate.
public | clear `clear() as Void:` | Clears the frame with spaces and the default style.
public | contains `contains(row as Int, col as Int) as Boolean:` | Returns true when the coordinate belongs to the frame.
public | copy `copy() as TerminalFrame:` | Returns a deep copy of the frame.
public | copyRegion `copyRegion(row as Int, col as Int, width as Int, height as Int) as TerminalFrame:` | Returns a sub-frame copy.
public | defaultStyle `defaultStyle() as RenderStyle:` | Returns the default style of the frame.
public | fillRect `fillRect(row as Int, col as Int, width as Int, height as Int, glyph as Char = ' ', style as RenderStyle = null) as Void:` | Fills a rectangular region with the same glyph and style.
public static | glyphClusterDisplayWidth `glyphClusterDisplayWidth(text as String, start as Int, end as Int) as Int:` | No summary.
public static | glyphDisplayWidth `glyphDisplayWidth(glyph as Char) as Int:` | Returns the number of terminal columns occupied by one Unicode scalar.
public static | nextGlyphClusterEnd `nextGlyphClusterEnd(text as String, start as Int) as Int:` | No summary.
public static | previousGlyphClusterStart `previousGlyphClusterStart(text as String, index as Int) as Int:` | No summary.
public static | textDisplayWidth `textDisplayWidth(text as String) as Int:` | Returns the terminal display width of plain text.
public | toAnsiText `toAnsiText() as String:` | Returns the frame as ANSI text for debug snapshots.
public | toPlainText `toPlainText() as String:` | Returns the frame as exact plain text, one line per row.
public static | trimTextToDisplayWidth `trimTextToDisplayWidth(text as String, maxWidth as Int) as String:` | Trims plain text to a terminal display width without splitting wide glyphs or emoji grapheme clusters.
public | writeCell `writeCell(row as Int, col as Int, glyph as Char, style as RenderStyle = null) as Void:` | Writes one logical glyph.
public | writeStyledText `writeStyledText(row as Int, col as Int, text as String, style as RenderStyle = null, maxWidth as Int = -1) as Void:` | Writes plain text using a fixed style, without ANSI parsing.
public | writeText `writeText(row as Int, col as Int, text as String, maxWidth as Int = -1) as Void:` | Writes ANSI-capable text into the frame.

Inherited Methods
method Inherited Methods from Object: deepCopy, fromJson, toDict, toJson, toString, toXml