module
Tput::Output::Emulator
Included Modules
- Crystallabs::Helpers::Alias_Methods
Direct including types
Defined in:
tput/output/emulator.crInstance Method Summary
-
#begin_hyperlink(uri : String, id : String | Nil = nil) : Nil
OSC 8: begins a hyperlink to uri.
-
#begin_synchronized_update : Nil
Begins a synchronized update (DEC private mode 2026): the terminal holds off presenting output until
#end_synchronized_update, then repaints the whole frame at once, removing flicker/tearing from a multi-write redraw. -
#clear_clipboard(selection : String = "c") : Nil
OSC 52: clears the terminal clipboard selection.
-
#copy_to_clipboard(text)
Copies text to clipboard.
-
#disable_color_scheme_notifications : Nil
Disables color-scheme change notifications (DEC 2031).
-
#disable_grapheme_clustering : Nil
Disables Unicode grapheme clustering (DEC 2027).
-
#disable_modifiers(param = "")
CSI > Ps n Disable modifiers which may be enabled via the CSI > Ps; Ps m sequence.
-
#enable_color_scheme_notifications : Nil
Enables color-scheme (light/dark) change notifications (DEC private mode 2031).
-
#enable_grapheme_clustering : Nil
Enables Unicode grapheme clustering (DEC private mode 2027): the terminal advances the cursor by grapheme cluster (emoji ZWJ sequences, base + combining marks, regional-indicator flags) rather than by codepoint, matching this library's
full_unicodecell model. -
#end_hyperlink : Nil
OSC 8: ends the current hyperlink (empty URI), so following text is no longer clickable.
-
#end_synchronized_update : Nil
Ends a synchronized update (DEC 2026), presenting the buffered frame.
-
#hyperlink(text : String, uri : String, id : String | Nil = nil) : Nil
OSC 8: emits text as a hyperlink to uri (begin + text + end).
-
#mouse_cursor_shape(name : String)
OSC 22 ; Pt ST Set the GUI mouse-pointer shape (the windowing-system cursor the user moves with the mouse) while the pointer is over this terminal window.
-
#mouse_cursor_shape(shape : MouseCursorShape)
OSC 22 ; Pt ST Set the GUI mouse-pointer shape (the windowing-system cursor the user moves with the mouse) while the pointer is over this terminal window.
-
#progress(progress : Int32 = 0, state : Int32 = 1) : Nil
OSC 9;4: drives the terminal's progress indicator (taskbar / tab badge).
-
#report_cwd(path : String, host : String = "") : Nil
OSC 7: reports path to the terminal as the current working directory (as a
file://URI), so terminals that track cwd — "open new tab/split here", window/tab titles — follow along. -
#request_clipboard(selection : String = "c") : Nil
OSC 52: asks the terminal to report the clipboard selection without waiting for the reply (
\e]52;<sel>;?\a). -
#reset_mouse_cursor_shape
OSC 22 ; ST Restore the GUI mouse-pointer to the terminal's default shape, undoing a previous
#mouse_cursor_shape. -
#reset_title_modes(*arguments)
CSI > Ps; Ps T Reset one or more features of the title modes to the default value.
-
#set_clipboard(text : String, selection : String = "c") : Nil
OSC 52: sets the terminal clipboard selection to text (base64-encoded as the protocol requires).
-
#set_pointer_mode(param = "")
CSI > Ps p Set resource value pointerMode.
-
#set_resources(*arguments)
CSI > Ps; Ps m Set or reset resource-values used by xterm to decide whether to construct escape sequences holding information about the modifiers pressed with a given key.
-
#set_title_mode_feature(*arguments)
CSI > Ps; Ps t Set one or more features of the title modes.
-
#synchronized_update(&)
Brackets block's output in a synchronized update (DEC 2026) so the frame it draws is presented atomically.
-
#title=(title : String)
Sets terminal emulator's title.
Instance Method Detail
OSC 8: begins a hyperlink to uri. Text emitted until #end_hyperlink
(or the next #begin_hyperlink) is clickable. id groups links that
should highlight as one when hovered — use the same id for a link
split across cells/lines. Widely supported (VTE, kitty, iTerm2,
WezTerm, foot, …) and ignored elsewhere.
Begins a synchronized update (DEC private mode 2026): the terminal holds
off presenting output until #end_synchronized_update, then repaints
the whole frame at once, removing flicker/tearing from a multi-write
redraw. Harmless where unsupported (ignored, and auto-released after a
short timeout so a missing end can't freeze the screen). Prefer the
#synchronized_update block, which always pairs the end marker.
OSC 52: clears the terminal clipboard selection.
Copies text to clipboard. Does nothing if terminal emulator is not iTerm2.
Fall back to an external clipboard program when this capability is missing:
Example: unless copy_to_clipboard text exec_clipboard_program text end
Disables color-scheme change notifications (DEC 2031).
CSI > Ps n Disable modifiers which may be enabled via the CSI > Ps; Ps m sequence. This corresponds to a resource value of "-1", which cannot be set with the other sequence. The parameter identi- fies the resource to be disabled: Ps = 1 -> modifyCursorKeys. Ps = 2 -> modifyFunctionKeys. Ps = 4 -> modifyOtherKeys. If the parameter is omitted, modifyFunctionKeys is disabled. When modifyFunctionKeys is disabled, xterm uses the modifier keys to make an extended sequence of functions rather than adding a parameter to each function key to denote the modi- fiers.
Enables color-scheme (light/dark) change notifications (DEC private
mode 2031). The terminal reports theme changes in-band as
CSI ? 997 ; 1 n (dark) / CSI ? 997 ; 2 n (light), surfaced as the
color_scheme of Tput::Input#listen events. Query the current
scheme with #request_color_scheme. Harmless where unsupported.
Enables Unicode grapheme clustering (DEC private mode 2027): the
terminal advances the cursor by grapheme cluster (emoji ZWJ
sequences, base + combining marks, regional-indicator flags) rather
than by codepoint, matching this library's full_unicode cell model.
Harmless where unsupported.
OSC 8: ends the current hyperlink (empty URI), so following text is no longer clickable.
Ends a synchronized update (DEC 2026), presenting the buffered frame.
OSC 8: emits text as a hyperlink to uri (begin + text + end).
OSC 22 ; Pt ST
Set the GUI mouse-pointer shape (the windowing-system cursor the user
moves with the mouse) while the pointer is over this terminal window.
This is distinct from Output::Cursor#cursor_shape, which styles the
blinking text caret.
Pt is an X11 cursor-font glyph name — pass a MouseCursorShape
(whose #cursor_name supplies it) or the raw name string. Per-window
and best-effort: xterm honors OSC 22, but most other emulators (and
Wayland-native terminals) ignore it, and an Xcursor theme may remap
the glyph. Persists until #reset_mouse_cursor_shape, the pointer
leaves the window, or the program exits — callers should arrange to
reset it (e.g. on mouse-out).
OSC 22 ; Pt ST
Set the GUI mouse-pointer shape (the windowing-system cursor the user
moves with the mouse) while the pointer is over this terminal window.
This is distinct from Output::Cursor#cursor_shape, which styles the
blinking text caret.
Pt is an X11 cursor-font glyph name — pass a MouseCursorShape
(whose #cursor_name supplies it) or the raw name string. Per-window
and best-effort: xterm honors OSC 22, but most other emulators (and
Wayland-native terminals) ignore it, and an Xcursor theme may remap
the glyph. Persists until #reset_mouse_cursor_shape, the pointer
leaves the window, or the program exits — callers should arrange to
reset it (e.g. on mouse-out).
OSC 9;4: drives the terminal's progress indicator (taskbar / tab badge). state: 0 = clear, 1 = normal (show progress, 0–100), 2 = error, 3 = indeterminate, 4 = warning/paused. Supported by ConEmu, Windows Terminal, WezTerm, ghostty, … and ignored elsewhere.
OSC 7: reports path to the terminal as the current working directory
(as a file:// URI), so terminals that track cwd — "open new tab/split
here", window/tab titles — follow along. host is the URI host (empty
= local). Ignored where unsupported.
OSC 52: asks the terminal to report the clipboard selection without
waiting for the reply (\e]52;<sel>;?\a). Use this while #listen is
active — the reply arrives through the input stream and is surfaced as a
paste. (Response#get_clipboard is the synchronous counterpart, for use
outside the input loop.)
OSC 22 ; ST
Restore the GUI mouse-pointer to the terminal's default shape, undoing
a previous #mouse_cursor_shape. xterm treats an empty Pt as "reset
to default"; terminals without OSC 22 ignore it.
CSI > Ps; Ps T Reset one or more features of the title modes to the default value. Normally, "reset" disables the feature. It is possi- ble to disable the ability to reset features by compiling a different default for the title modes into xterm. Ps = 0 -> Do not set window/icon labels using hexadecimal. Ps = 1 -> Do not query window/icon labels using hexadeci- mal. Ps = 2 -> Do not set window/icon labels using UTF-8. Ps = 3 -> Do not query window/icon labels using UTF-8. (See discussion of "Title Modes").
OSC 52: sets the terminal clipboard selection to text
(base64-encoded as the protocol requires). selection is "c" for the
clipboard, "p" for primary, etc. Unlike OS-level clipboard tools this
works through SSH and tmux. Read back with #get_clipboard. Harmless
on terminals without OSC 52 support (they ignore it).
CSI > Ps p Set resource value pointerMode. This is used by xterm to decide whether to hide the pointer cursor as the user types. Valid values for the parameter: Ps = 0 -> never hide the pointer. Ps = 1 -> hide if the mouse tracking mode is not enabled. Ps = 2 -> always hide the pointer. If no parameter is given, xterm uses the default, which is 1 .
CSI > Ps; Ps m Set or reset resource-values used by xterm to decide whether to construct escape sequences holding information about the modifiers pressed with a given key. The first parameter iden- tifies the resource to set/reset. The second parameter is the value to assign to the resource. If the second parameter is omitted, the resource is reset to its initial value. Ps = 1 -> modifyCursorKeys. Ps = 2 -> modifyFunctionKeys. Ps = 4 -> modifyOtherKeys. If no parameters are given, all resources are reset to their initial values.
CSI > Ps; Ps t Set one or more features of the title modes. Each parameter enables a single feature. Ps = 0 -> Set window/icon labels using hexadecimal. Ps = 1 -> Query window/icon labels using hexadecimal. Ps = 2 -> Set window/icon labels using UTF-8. Ps = 3 -> Query window/icon labels using UTF-8. (See dis- cussion of "Title Modes") XXX VTE bizarelly echos this:
Brackets block's output in a synchronized update (DEC 2026) so the frame it draws is presented atomically. The end marker is emitted even if the block raises, so a failure cannot leave the terminal frozen.