class

Tput

Inherits Tput::Input / Crystallabs::Helpers::Logging / Tput::Output / Tput::Output::Terminal / Tput::Macros / Crystallabs::Helpers::Alias_Methods / Tput::Output::Screen / Tput::Macros / Crystallabs::Helpers::Alias_Methods / Tput::Output::Mouse / Tput::Macros / Crystallabs::Helpers::Alias_Methods / Tput::Output::Rectangles / Tput::Macros / Crystallabs::Helpers::Alias_Methods / Tput::Output::Bell / Tput::Macros / Crystallabs::Helpers::Alias_Methods / Tput::Output::Colors / Tput::Macros / Crystallabs::Helpers::Alias_Methods / Tput::Output::Emulator / Tput::Macros / Crystallabs::Helpers::Alias_Methods / Tput::Output::Charset / Tput::Macros / Crystallabs::Helpers::Alias_Methods / Tput::Output::Scrolling / Tput::Macros / Crystallabs::Helpers::Alias_Methods / Tput::Output::Misc / Tput::Macros / Crystallabs::Helpers::Alias_Methods / Tput::Output::Text / Tput::Macros / Crystallabs::Helpers::Logging / Crystallabs::Helpers::Alias_Methods / Tput::Output::Cursor / Tput::Macros / Crystallabs::Helpers::Boolean / Crystallabs::Helpers::Alias_Methods / Crystallabs::Helpers::Logging / Tput::ACSC / Crystallabs::Helpers::Logging / Tput::Coordinates / Crystallabs::Helpers::Logging / Crystallabs::Helpers::Logging / JSON::Serializable / Tput::Namespace / Reference / Object

Many Tput methods correspond to terminal sequences. Often times methods are named according to their purpose, and then aliased to the names of sequences used behind the scenes.

For example, method #delete_columns is directly implemented using sequence decdc. Therefore, it is also accessible under the alias #decdc.

Furthermore, for understanding the instructions on terminal sequences, the following names are important:

ESC - Sequence starting with ESC (\e)
CSI - Control Sequence Introducer: sequence starting with ESC [ (7bit) or CSI (\x9B, 8bit)
DCS - Device Control String: sequence starting with ESC P (7bit) or DCS (\x90, 8bit)
OSC - Operating System Command: sequence starting with ESC ] (7bit) or OSC (\x9D, 8bit)
C0: single byte command (7bit control codes, byte range \x00 .. \x1F, \x7F)
C1: single byte command (8bit control codes, byte range \x80 .. \x9F)

Some sequences accept arguments. Their naming and types correspond to those used in XTerm documentation:

Ps: A single (usually optional) numeric parameter, composed of one or more decimal digits.
Pm: A multiple numeric parameter composed of any number of single numeric parameters, separated by ";", e.g. ` Ps ; Ps ; … `.
Pt: A text parameter composed of printable characters.

In all of the examples above, spaces exist just for clarity and are not part of actual escape sequences. For example, in "ESC [" or " Ps ; Ps ;" there are no actual spaces.

Constants

CSI7 = "\e["
CSI8 = "\x9B"
DCS7 = "\eP"
DCS8 = "\x90"
DEFAULT_SCREEN_SIZE = Size.new(80, 24)
ESC = "\e"
Log = ::Log.for((self.name.gsub("::", '.')).underscore)
OSC7 = "\e]"
OSC8 = "\x9D"
VERSION = "1.0.8"

Constructors

new(pull : JSON::PullParser)
Source
new(terminfo : Nil | Unibilium::Terminfo = nil, input : IO = STDIN, output : IO = STDOUT.dup, error : IO = STDERR.dup, force_unicode = nil, use_buffer : Bool = true, screen_size = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

_exiting=(_exiting : Bool)
Source
_exiting?
Source
_saved
Source
_saved=(_saved : Hash(String | Symbol | UInt64, Tput::Namespace::CursorState))
Source
_title
Source
cursor
Source
cursor_hidden?
Source
emulator
Source
emulator?
Source
error
Source
error=(error : IO)
Source
features
Source
features?
Source
force_unicode?
Source
has?
Source
input
Source
input=(input : IO)
Source
is_alt
Source
name?(nam : String)
Source
name?(*names)
Source
output
Source
output=(output : IO)
Source
pause(callback : Proc | Nil = nil)
Source
put

Outputs a string capability to the designated @output, if the capability exists.

For this method to work, the Tput instance needs to be initialized with Terminfo data. If Terminfo data is not present, nil will be returned.

put &.smcup?

put &.cursor_pos?(10, 20)
Source
read_timeout

Timeout when reading escape sequences. If an escape sequence (ESC) comes in on input, we have no way of telling whether this is an ESC key or the start of an escape sequence. So we read with a timeout. If there is no input by the time it times out, we consider it was a key press.

All other apps like Vi etc. read the escape key in the terminal this way.

The default timeout is 400 milliseconds, the same as in Qt.

Source
resume
Source
ret=(ret : IO | Nil)
Source
saved_cursor
Source
screen
Source
scroll_bottom
Source
scroll_top
Source
shim
Source
sigtstp(callback)
Source
terminfo
Source
use_buffer?
Source

Nested types