module Tput::Output

Included Modules

Direct including types

Defined in:

tput/output.cr
tput/output/bell.cr
tput/output/charset.cr
tput/output/colors.cr
tput/output/cursor.cr
tput/output/emulator.cr
tput/output/misc.cr
tput/output/mouse.cr
tput/output/rectangles.cr
tput/output/screen.cr
tput/output/scrolling.cr
tput/output/terminal.cr
tput/output/text.cr

Constant Summary

Log = ::Log.for((self.name.gsub("::", '.')).underscore)
PADDING_RE = /\$<([\d.]+)([*\/]{0,2})>/

Matches a terminfo padding instruction: $<delay[*/]>, where delay is a number of milliseconds (optionally fractional) and the optional * / / suffixes mark it as proportional / mandatory respectively.

Instance Method Summary

Instance methods inherited from module Tput::Output::Terminal

decrqm(param = "") decrqm, decrqmp(param = "") decrqmp, decrst(*arguments) decrst, decscl(*arguments) decscl, decset(*arguments) decset, disable_keypad disable_keypad, enable_keypad enable_keypad, manipulate_window(*arguments) manipulate_window, maximize_window maximize_window, request_ansi_mode(param = "") request_ansi_mode, request_private_mode(param = "") request_private_mode, reset reset, reset_mode(*arguments) reset_mode, resize_window(height, width) resize_window, restore_private_values(*arguments) restore_private_values, rm(*arguments) rm, save_private_values(*arguments) save_private_values, set_conformance_level(*arguments) set_conformance_level, set_mode(*arguments) set_mode, sm(*arguments) sm, soft_reset soft_reset, xtwinops(*arguments) xtwinops

Instance methods inherited from module Tput::Output::Screen

alternate_buffer alternate_buffer, clear clear, ed(param = Erase::Below) ed, erase_in_display(param = Erase::Below) erase_in_display, normal_buffer normal_buffer

Instance methods inherited from module Tput::Output::Mouse

decefr(*arguments) decefr, decelr(*arguments) decelr, decsle(*arguments) decsle, disable_mouse(focus : Bool = false) disable_mouse, enable_filter_rectangle(*arguments) enable_filter_rectangle, enable_locator_reporting(*arguments) enable_locator_reporting, enable_mouse(focus : Bool | Nil = nil, pixels : Tuple(Int32, Int32) | Bool | Nil = nil) enable_mouse, set_locator_events(*arguments) set_locator_events, set_mouse(x10 : Bool | Nil = nil, vt200 : Bool | Nil = nil, vt200_hilite : Bool | Nil = nil, cell_motion : Bool | Nil = nil, all_motion : Bool | Nil = nil, send_focus : Bool | Nil = nil, utf : Bool | Nil = nil, sgr : Bool | Nil = nil, urxvt : Bool | Nil = nil, pixels : Bool | Nil = nil, dec : Bool | Nil = nil, pterm : Bool | Nil = nil, jsbterm : Bool | Nil = nil, normal : Bool | Nil = nil, hilite_tracking : Bool | Nil = nil) set_mouse

Instance methods inherited from module Tput::Output::Rectangles

copy_rectangle(*arguments) copy_rectangle, deccara(*arguments) deccara, deccra(*arguments) deccra, decera(top = 0, left = 0, bottom = @screen.height - 1, right = @screen.width - 1) decera, decfra(*arguments) decfra, decrara(*arguments) decrara, decsace(param = 0) decsace, decsera(top = 0, left = 0, bottom = @screen.height - 1, right = @screen.width - 1) decsera, erase_rectangle(top = 0, left = 0, bottom = @screen.height - 1, right = @screen.width - 1) erase_rectangle, fill_rectangle(*arguments) fill_rectangle, reverse_attr_in_rectangle(*arguments) reverse_attr_in_rectangle, select_change_extent(param = 0) select_change_extent, selective_erase_rectangle(top = 0, left = 0, bottom = @screen.height - 1, right = @screen.width - 1) selective_erase_rectangle, set_attr_in_rectangle(*arguments) set_attr_in_rectangle

Instance methods inherited from module Tput::Output::Bell

bell bell, decsmbv=(param : Volume) decsmbv=, decswbv=(param : Volume) decswbv=, margin_bell_volume=(param : Volume) margin_bell_volume=, warning_bell_volume=(param : Volume) warning_bell_volume=

Instance methods inherited from module Tput::Output::Colors

dynamic_colors(param) dynamic_colors, reset_colors(param = "") reset_colors

Instance methods inherited from module Tput::Output::Emulator

begin_hyperlink(uri : String, id : String | Nil = nil) : Nil begin_hyperlink, begin_synchronized_update : Nil begin_synchronized_update, clear_clipboard(selection : String = "c") : Nil clear_clipboard, copy_to_clipboard(text) copy_to_clipboard, disable_color_scheme_notifications : Nil disable_color_scheme_notifications, disable_grapheme_clustering : Nil disable_grapheme_clustering, disable_modifiers(param = "") disable_modifiers, enable_color_scheme_notifications : Nil enable_color_scheme_notifications, enable_grapheme_clustering : Nil enable_grapheme_clustering, end_hyperlink : Nil end_hyperlink, end_synchronized_update : Nil end_synchronized_update, hyperlink(text : String, uri : String, id : String | Nil = nil) : Nil hyperlink, mouse_cursor_shape(name : String)
mouse_cursor_shape(shape : MouseCursorShape)
mouse_cursor_shape
, progress(progress : Int32 = 0, state : Int32 = 1) : Nil progress, report_cwd(path : String, host : String = "") : Nil report_cwd, request_clipboard(selection : String = "c") : Nil request_clipboard, reset_mouse_cursor_shape reset_mouse_cursor_shape, reset_title_modes(*arguments) reset_title_modes, set_clipboard(text : String, selection : String = "c") : Nil set_clipboard, set_pointer_mode(param = "") set_pointer_mode, set_resources(*arguments) set_resources, set_title_mode_feature(*arguments) set_title_mode_feature, synchronized_update(&) synchronized_update, title=(title : String) title=

Instance methods inherited from module Tput::Output::Charset

charset=(charset : C | Nil) charset=, enable_acs enable_acs, enter_alt_charset_mode enter_alt_charset_mode, exit_alt_charset_mode exit_alt_charset_mode, set_g(val) set_g

Instance methods inherited from module Tput::Output::Scrolling

decstbm(top : Int = 0, bottom : Int = (@screen.height - 1)) decstbm, index index, reverse_index reverse_index, scroll_down(param = 1) scroll_down, scroll_up(param = 1) scroll_up, sd(param = 1) sd, set_scroll_region(top : Int = 0, bottom : Int = (@screen.height - 1)) set_scroll_region, su(param = 1) su

Instance methods inherited from module Tput::Output::Misc

decll(param = 0) decll, escape escape, load_leds(param = 0) load_leds, mc(*arguments) mc, mc0 mc0, mc4 mc4, mc5 mc5, mc5p mc5p, media_copy(*arguments) media_copy, null null, repeat(str, i = 1) repeat

Instance methods inherited from module Tput::Output::Text

_attr(param : Array | String, val = true) _attr, attr(param, val) attr, backspace backspace, bg(color, val) bg, carriage_return carriage_return, char_attributes(param, val) char_attributes, dch(param = 1) dch, decdc(n = 1) decdc, decic(n = 1) decic, decsca(param = 0) decsca, delete_chars(param = 1) delete_chars, delete_columns(n = 1) delete_columns, delete_line(param : Int = 1) delete_line, dl(param : Int = 1) dl, ech(param : Int = 1) ech, echo(text, attr = nil) echo, el(param = LineDirection::Right) el, erase_character(param : Int = 1) erase_character, erase_chars(param : Int = 1) erase_chars, erase_in_line(param = LineDirection::Right) erase_in_line, fg(color, val) fg, form_feed form_feed, horizontal_tabulation_set horizontal_tabulation_set, ich(param = 1) ich, il(param : Int = 1) il, insert_chars(param = 1) insert_chars, insert_columns(n = 1) insert_columns, insert_line(param : Int = 1) insert_line, line_feed line_feed, line_height line_height, rep(param = 1) rep, repeat_preceding_character(param = 1) repeat_preceding_character, rpc(param = 1) rpc, sel_data(a, b) sel_data, set_background(color, val) set_background, set_char_protection_attr(param = 0) set_char_protection_attr, set_foreground(color, val) set_foreground, sgr(param, val) sgr, shift_in shift_in, shift_out shift_out, simple_insert(str, i = 1, attr = nil) simple_insert, tab_clear(param = 0) tab_clear, tbc(param = 0) tbc, text(text, attr) text, vertical_tab vertical_tab

Instance methods inherited from module Tput::Output::Cursor

back(param = 1) back, cbt(param = 1) cbt, cha(point : Point)
cha(param = 0)
cha
, char_pos_absolute(param = 0) char_pos_absolute, cht(param = 1) cht, cnl(param = 1) cnl, cpl(param = 1) cpl, cub(param = 1) cub, cud(param = 1) cud, cuf(param : Int = 1) cuf, cup(row : Int = 0, column : Int = 0)
cup(point : Tput::Point)
cup
, cursor_backward(param = 1) cursor_backward, cursor_backward_tab(param = 1) cursor_backward_tab, cursor_char_absolute(point : Point)
cursor_char_absolute(param = 0)
cursor_char_absolute
, cursor_color(color : String)
cursor_color(color : Color)
cursor_color
, cursor_down(param = 1) cursor_down, cursor_forward(param : Int = 1) cursor_forward, cursor_forward_tab(param = 1) cursor_forward_tab, cursor_line_absolute(point : Point)
cursor_line_absolute(param = 0)
cursor_line_absolute
, cursor_move(point : Point)
cursor_move(x = 0, y = 0)
cursor_move
, cursor_move_to(point : Point)
cursor_move_to(x = 0, y = 0)
cursor_move_to
, cursor_next_line(param = 1) cursor_next_line, cursor_pos(row : Int = 0, column : Int = 0)
cursor_pos(point : Tput::Point)
cursor_pos
, cursor_position(row : Int = 0, column : Int = 0)
cursor_position(point : Tput::Point)
cursor_position
, cursor_preceding_line(param = 1) cursor_preceding_line, cursor_previous_line(param = 1) cursor_previous_line, cursor_right(param : Int = 1) cursor_right, cursor_shape(shape, blink = false) cursor_shape, cursor_up(param = 1) cursor_up, cuu(param = 1) cuu, decscusr(style = CursorStyle::SteadyBlock) decscusr, down(param = 1) down, dynamic_cursor_color(param) dynamic_cursor_color, forward(param : Int = 1) forward, h_position_relative(param = 1) h_position_relative, hide_cursor hide_cursor, hpa(param = 0) hpa, hpr(param = 1) hpr, hv_position(row = 0, col = 0) hv_position, hvp(row = 0, col = 0) hvp, left(param = 1) left, line_absolute(point : Point)
line_absolute(param = 0)
line_absolute
, line_pos_absolute(point : Point)
line_pos_absolute(param = 0)
line_pos_absolute
, lrestore_cursor(key = :local, hide = false) lrestore_cursor, lsave_cursor(key = :local) lsave_cursor, move(point : Point)
move(x = 0, y = 0)
move
, omove(point : Point)
omove(x = 0, y = 0)
omove
, parm_right_cursor(param : Int = 1) parm_right_cursor, pos(row : Int = 0, column : Int = 0)
pos(point : Tput::Point)
pos
, reset_cursor reset_cursor, reset_cursor_color reset_cursor_color, restore_cursor(key : String | Nil = nil, hide : Bool = false) restore_cursor, restore_cursor_a restore_cursor_a, restore_reported_cursor restore_reported_cursor, right(param : Int = 1) right, rmove(dx, dy)
rmove(point : Point)
rmove
, rsetx(dx) rsetx, rsety(dy) rsety, save_cursor(key : String | Nil = nil) save_cursor, save_cursor_a save_cursor_a, sc(key : String | Nil = nil) sc, set_cursor_style(style = CursorStyle::SteadyBlock) set_cursor_style, set_x(point : Point)
set_x(param = 0)
set_x
, set_y(point : Point)
set_y(param = 0)
set_y
, setx(point : Point)
setx(param = 0)
setx
, sety(point : Point)
sety(param = 0)
sety
, setyx(row : Int = 0, column : Int = 0)
setyx(point : Tput::Point)
setyx
, show_cursor show_cursor, up(param = 1) up, v_position_relative(param = 1) v_position_relative, vpa(point : Point)
vpa(param = 0)
vpa
, vpr(param = 1) vpr

Instance Method Detail

def _oprint(*args) #

[View source]
def _owrite(*args) #

Directly writes string to @output (usually STDOUT).

Mostly not used directly, but through #_write.


[View source]
def _pad_write(code : Bytes) : Bool #

Standard output method which takes terminal padding (software timing/delays) into account.

Compiled terminfo capabilities can embed padding instructions of the form $<delay> (e.g. $<5>, $<10*>, $<5/>). Unibilium performs parameter substitution but, like ncurses' tparm, leaves these markers in the output; honoring them (ncurses' tputs job) is left to us. Strips the markers and, where the terminal lacks hardware flow control, sleeps for the requested delay before emitting the following bytes.

With no padding instructions, behaves like #_write. See ncurses' tinfo/lib_tputs.c.


[View source]
def _print(*args) #

[View source]
def _print(& : IO -> Nil) #

[View source]
def _tprint(data) #

Wrap escape sequences in DCS sequences and directly print to @output.

A terminal multiplexer (tmux or GNU screen) only forwards an escape sequence to the outer terminal if wrapped in that multiplexer's DCS passthrough. Applies the wrapping when the detected emulator is tmux or screen, then prints directly to @output (flushing any existing buffer first). On a non-multiplexed terminal, behaves like #_write.

Example (tmux):   `DCS tmux; ESC Pt ST`  ->  `\ePtmux;\e … \e\\`
Example (screen): `DCS ESC Pt ST`        ->  `\eP … \e\\`

[View source]
def _with_io(& : IO -> Nil) #

[View source]
def _write(*args) #

Standard output method.

Takes into account internal buffering.


[View source]
def flush #

Flushes internal buffer into @output and calls @output.flush


[View source]