module

Term2::Zone

Constants

IDENT_BRACKET = '['
IDENT_END = 'z'
IDENT_START = '\e'

ANSI escape sequence for zone markers Format: \x1B[<number>z

Class methods

any_in_bounds(model : M, event : MouseEvent) : Nil forall M

Call update with ZoneInBoundsMsg for any zones under the mouse.

Note: we intentionally accept any concrete model type here rather than Model directly. Calling abstract methods on a module-typed value can fail to compile in some contexts; using a generic receiver keeps the dispatch concrete.

Source
any_in_bounds?(x : Int32, y : Int32) : Bool

Check if any zone is in bounds for the given coordinates

Source
any_in_bounds_and_update(model : M, event : MouseEvent) : Tuple(M, Cmd) forall M
Source
blur(id : String)

Blur a zone

Source
clear(id : String)

Clear a specific zone

Source
clear

Clear all registered zones

Source
clear_all

Clear all zones (alias for clear method)

Source
clear_zones

Clear only zone geometry for a new frame, while preserving marker mappings. This allows scan() to resolve markers embedded in the rendered frame.

Source
close
Source
enabled=(value : Bool)
Source
enabled?

Enable/disable zone tracking

Source
find_all_at(x : Int32, y : Int32) : Array(ZoneInfo)

Find all zones at the given coordinates

Source
find_at(x : Int32, y : Int32) : ZoneInfo | Nil

Find zone at coordinates

Source
find_smallest_at(x : Int32, y : Int32) : ZoneInfo | Nil

Get the smallest zone at the given coordinates (by area, then z-index)

Source
focus(id : String)

Focus a zone

Source
focus_next

Tab to next zone

Source
focus_prev

Tab to previous zone

Source
focused?(id : String) : Bool

Check if a zone is focused

Source
focused_id

Get focused zone ID

Source
focused_id=(id : String | Nil)

Set focused zone ID

Source
get(id : String) : ZoneInfo

Get zone by ID

Source
handle_mouse(event : MouseEvent) : ZoneClickMsg | Nil

Handle mouse event

Source
mark(id : String, content : String) : String

Mark content with zone markers

Source
marker_counter

Get the current marker counter (for testing)

Source
new_prefix

Generate a new unique prefix for markers

Source
register(id : String, start_x : Int32, start_y : Int32, end_x : Int32, end_y : Int32, z_index : Int32 = 0)

Register a zone directly (for testing)

Source
reset

Reset all zone state (used in tests)

Source
scan(output : String) : String

Scan output and extract zones

Source
zones

Get all registered zones

Source