class CryTUI::AnsiBackend

Overview

ANSI/VT backend for modern terminals. Capability negotiation and raw input are separate concerns; this class owns output state and restoration only.

Defined in:

crytui/ansi_backend.cr

Constant Summary

MOUSE_OFF = "\e[?1006l\e[?1002l\e[?1000l"
MOUSE_ON = "\e[?1000h\e[?1002h\e[?1006h"

Button-event tracking reports presses, releases, and motion while a button is held, which is what a drag needs; 1006 asks for SGR-encoded coordinates so columns past 223 still report correctly.

Constructors

Instance Method Summary

Instance methods inherited from class CryTUI::Backend

clear : Nil clear, draw(changes : Array(Tuple(Int32, Int32, Cell))) : Nil draw, enter : Nil enter, leave : Nil leave, refresh_size : Bool refresh_size, size : Rect size

Constructor Detail

def self.for_terminal(io : IO, size_source : IO::FileDescriptor, alternate_screen = true, mouse = true) : self #

[View source]
def self.new(io : IO, width : Int, height : Int, alternate_screen : Bool = true, size_source : IO::FileDescriptor | Nil = nil, mouse : Bool = true) #

[View source]

Instance Method Detail

def clear : Nil #

[View source]
def draw(changes : Array(Tuple(Int32, Int32, Cell))) : Nil #

[View source]
def enter : Nil #

[View source]
def io : IO #

[View source]
def leave : Nil #

Mouse tracking is released before the alternate screen, so a terminal that survives the process still stops reporting. Leaving it on would spray escape sequences into whatever shell prompt comes back.


[View source]
def refresh_size : Bool #

[View source]
def resize(width : Int, height : Int) #

[View source]
def size : Rect #

[View source]