ttx 0.1.0
Loading...
Searching...
No Matches
ttx::terminal Namespace Reference

Classes

struct  Capability
 Represents a Termcap capability. More...
 
struct  Cell
 Represents a on-screen terminal cell. More...
 
struct  Cursor
 Represents the current cursor position of the terminal. More...
 
struct  CursorPositionReport
 Cursor position report. More...
 
struct  Hyperlink
 Represents a hyperlink specified via OSC 6. More...
 
class  IdMap
 A two-way map between a numberic id and a value. More...
 
struct  Key
 
struct  KittyKeyReport
 Kitty key protocol status report. More...
 
struct  ModeQueryReply
 Terminal DEC request query mode reply. More...
 
struct  MultiCellInfo
 Shared information for cells linked via text sizing protocol (OSC 66) or double width characters. More...
 
struct  OperatingStatusReport
 Operating status report. More...
 
struct  OSC52
 Represents an OSC 52 sequence, which allows for modifying or querying the clipboard. More...
 
struct  OSC66
 Represents text annotated using the text sizing protocol. More...
 
struct  OSC7
 Represents a application current working directory report. More...
 
struct  OSC8
 Represents a terminal hyperlink escape sequence. More...
 
struct  PrimaryDeviceAttributes
 Terminal primary device attributes. More...
 
struct  Row
 Represents a on-screen terminal row of cells. More...
 
class  RowGroup
 Represents a group of terminal rows. More...
 
struct  SavedCursor
 Represents the saved cursor state, which is used for save/restore cursor operations. More...
 
class  Screen
 Represents the visible contents of the terminal (with no scroll back) More...
 
class  ScrollBack
 Represents the terminal scroll back. More...
 
struct  ScrollRegion
 Represents the scrolling region for a terminal. More...
 
struct  Selection
 Represents the visual selection of a terminal. More...
 
struct  SelectionPoint
 Represents a coordinate of a visual selection. More...
 
struct  StatusStringResponse
 Request status string response. More...
 
struct  Terminfo
 Represents a terminfo entry. More...
 
struct  TerminfoString
 Terminal response string (for XTGETTCAP) More...
 

Enumerations

enum class  AnsiMode { None = 0 }
 ANSI terminal modes. More...
 
enum class  DecMode {
  None = 0 , CursorKeysMode = 1 , Select80Or132ColumnMode = 3 , ReverseVideo = 5 ,
  OriginMode = 6 , AutoWrap = 7 , X10Mouse = 9 , CursorEnable = 25 ,
  Allow80Or132ColumnMode = 40 , HorizontalMargins , VT200Mouse = 1000 , CellMotionMouseTracking = 1002 ,
  AllMotionMouseTracking = 1003 , FocusEvent = 1004 , UTF8Mouse = 1005 , SGRMouse = 1006 ,
  AlternateScroll = 1007 , URXVTMouse = 1015 , SGRPixelMouse = 1016 , AlternateScreenBuffer = 1049 ,
  BrackedPaste = 2004 , SynchronizedOutput = 2026 , GraphemeClustering = 2027 , ThemeDetection = 2031 ,
  InBandSizeReports = 2048
}
 DEC private modes. More...
 
enum class  ModeSupport {
  Unknown = 0 , Set = 1 , Unset = 2 , AlwaysSet = 3 ,
  AlwaysUnset = 4
}
 
enum class  SelectionType : u8 {
  Clipboard , Selection , _0 , _1 ,
  _2 , _3 , _4 , _5 ,
  _6 , _7 , Max
}
 Represents the type of selection being modifed by an OSC 52 sequence. More...
 
enum class  AutoWrapMode { Disabled , Enabled }
 Whether or not auto-wrap (DEC mode 7) is enabled. More...
 
enum class  OriginMode { Disabled , Enabled }
 Whether or not origin mode (DEC mode 6) is enabled. More...
 

Functions

auto get_ttx_terminfo () -> Terminfo const &
 
auto lookup_terminfo_string (di::StringView hex_name) -> TerminfoString
 
constexpr auto tag_invoke (di::Tag< di::reflect >, di::InPlaceType< AnsiMode >)
 
constexpr auto tag_invoke (di::Tag< di::reflect >, di::InPlaceType< DecMode >)
 
constexpr auto tag_invoke (di::Tag< di::reflect >, di::InPlaceType< ModeSupport >)
 
constexpr auto tag_invoke (di::Tag< di::reflect >, di::InPlaceType< SelectionType >)
 

Variables

constexpr auto narrow_multi_cell_info = MultiCellInfo { 1, 1 }
 
constexpr auto wide_multi_cell_info = MultiCellInfo { 1, 2 }
 
constexpr auto ttx_names
 
constexpr auto ttx_capabilities
 
constexpr auto ttx_terminfo
 
constexpr auto selection_mapping
 
constexpr auto keys
 

Enumeration Type Documentation

◆ AnsiMode

enum class ttx::terminal::AnsiMode
strong

ANSI terminal modes.

For now, these are left as a placeholder as none are supported.

Enumerator
None 

◆ AutoWrapMode

enum class ttx::terminal::AutoWrapMode
strong

Whether or not auto-wrap (DEC mode 7) is enabled.

Enumerator
Disabled 
Enabled 

◆ DecMode

enum class ttx::terminal::DecMode
strong

DEC private modes.

Unless otherwise specified, these modes are documented by xterm here.

Enumerator
None 
CursorKeysMode 

Enable application cursor keys mode.

This controls whether the arrow keys are reported using CSI or SS3 sequences when there are no modifiers.

Select80Or132ColumnMode 

Override the terminal column size to 80 or 132 columns.

ReverseVideo 

Reverse video mode.

In ttx, this mode is equivalent to toggling the "inverted" graphics rendition on every cell.

OriginMode 

Cursor origin mode.

This controls the interpretation of absolute cursor positions when setting the cursor. When origin mode is enabled, these positions are relative to the top-left scroll margin. Additionally, the cursor cannot move outside of the scroll region.

AutoWrap 

Auto-wrap mode.

This controls whether excess text on a line overwrites the last cell or causes a soft line break and moves the cursor to the next line. Its a soft break because resizing the terminal can reflow lines created in this way.

X10Mouse 

X10 (legacy) mouse mode.

This mode corresponds to both the X10 mosue reporting mode and X10 mouse event encoding protocol.

CursorEnable 

Cursor enable (toggle cursor visibility)

Allow80Or132ColumnMode 

Allow selecting 80 or 132 column mode.

HorizontalMargins 

Enable setting horizontal margins.

This mode appears to be needed as the escape sequence used for horizontal margins (CSI s) originally was used for saving the cursor. Applications should use ESC 7 for that purpose today.

VT200Mouse 

VT 200 mouse events - presses only.

CellMotionMouseTracking 

Cell motion mouse tracking - motion when held only.

AllMotionMouseTracking 

All motion mouse tracking - all mouse events.

FocusEvent 

Focus event mode (enable/disable)

UTF8Mouse 

UTF-8 mouse encoding.

SGRMouse 

SGR mouse encoding.

This is the most commonly used mouse encoding.

AlternateScroll 

Translate scrolling into up/down presses.

This mode is useful for applications like less which support scrolling but have no reason to process other mouse events.

URXVTMouse 

URXVT mouse encoding.

SGRPixelMouse 

SGR mouse pixel encoding.

AlternateScreenBuffer 

Use alternate screen buffer.

xterm specifies additionally modes for the alternate screen buffer, but they aren't needed. This mode additionally saves and restores the cursor which gives it better behavior.

BrackedPaste 

Denote paste events with CSI 200 ~ and CSI 201 ~.

SynchronizedOutput 

Synchronize screen render with application.

This prevents screen tearing by allowing applications to control when the terminal actually renders the screen. Typically, this is enabled at the start of drawing the screen and enabled once drawing is finished. This is specified here.

GraphemeClustering 

Perform grapheme clustering on inputs.

Older terminals naively computed the width of individual text by simply summing the result of the wcwidth() function, which operates on indivual code points. Terminals may additionally do other things.

For terminals which support this mode, combining characters (within a grapheme cluster, regardless of width) will not advance the cursor. Additionally, variation selector 16 forces a grapheme to have width 2. This behavior is specified here.

Depending on the terminal, this mode will either be hard-wired to 1 (contour, wezterm), or configurable (ghostty, foot). Additionally, terminals like kitty do not report supporting this mode but do support grapheme clustering by default.

ThemeDetection 

Enable automatic reports of users dark/light theme preference.

This allows an application to subscribe to updates when the user changes their theme preference. The terminal will send special device status report messages whenever this changes. This is specified here.

InBandSizeReports 

Enable automatic reports of the current terminal size.

This lets applications bypass the SIGWINCH mechanism and instead directly get size reports whenver the size changes. This is specified here.

◆ ModeSupport

enum class ttx::terminal::ModeSupport
strong
Enumerator
Unknown 

Terminal doesn't know this mode.

Set 

Mode is currently set.

Unset 

Mode is currently unset.

AlwaysSet 

Mode is set, and cannot be modified.

AlwaysUnset 

Mode is unset, and cannot be modified.

◆ OriginMode

enum class ttx::terminal::OriginMode
strong

Whether or not origin mode (DEC mode 6) is enabled.

When origin mode is enabled, the cursor is constrained to be within the scroll region of the screen. Additionally, all row and column indicies are relative to the top-left of the scroll region when origin is enabled.

Enumerator
Disabled 
Enabled 

◆ SelectionType

enum class ttx::terminal::SelectionType : u8
strong

Represents the type of selection being modifed by an OSC 52 sequence.

Enumerator
Clipboard 

Standard user clipboard (default)

Selection 

Primary selection clipboard.

_0 

Numbered buffers, never forwarded to the outer terminal.

_1 
_2 
_3 
_4 
_5 
_6 
_7 
Max 

Function Documentation

◆ get_ttx_terminfo()

auto ttx::terminal::get_ttx_terminfo ( ) -> Terminfo const&

◆ lookup_terminfo_string()

auto ttx::terminal::lookup_terminfo_string ( di::StringView hex_name) -> TerminfoString

◆ tag_invoke() [1/4]

auto ttx::terminal::tag_invoke ( di::Tag< di::reflect > ,
di::InPlaceType< AnsiMode >  )
constexpr

◆ tag_invoke() [2/4]

auto ttx::terminal::tag_invoke ( di::Tag< di::reflect > ,
di::InPlaceType< DecMode >  )
constexpr

◆ tag_invoke() [3/4]

auto ttx::terminal::tag_invoke ( di::Tag< di::reflect > ,
di::InPlaceType< ModeSupport >  )
constexpr

◆ tag_invoke() [4/4]

auto ttx::terminal::tag_invoke ( di::Tag< di::reflect > ,
di::InPlaceType< SelectionType >  )
constexpr

Variable Documentation

◆ keys

auto ttx::terminal::keys
constexpr
Initial value:
= di::Array {
Key("s"_sv, &MultiCellInfo::scale, 1, 7),
Key("w"_sv, &MultiCellInfo::width, 0, 7),
}
Key
Definition key.h:8
u8 horizontal_alignment
Horizontal fractional scale alignment.
Definition multi_cell_info.h:14
u8 fractional_scale_numerator
Fractional scale numerator.
Definition multi_cell_info.h:11
u8 width
Width in cells. When specified as 0 via OSC 66, the width is inferred.
Definition multi_cell_info.h:10
u8 vertical_alignment
Vertical fractional scale alignment.
Definition multi_cell_info.h:13
u8 fractional_scale_denominator
Fractional scale denominator.
Definition multi_cell_info.h:12
u8 scale
Vertiacl scale for the cell. This is applied multiplicatively to the width.
Definition multi_cell_info.h:9

◆ narrow_multi_cell_info

auto ttx::terminal::narrow_multi_cell_info = MultiCellInfo { 1, 1 }
inlineconstexpr

◆ selection_mapping

auto ttx::terminal::selection_mapping
constexpr
Initial value:
= di::Array {
di::Tuple { SelectionType::Clipboard, U'c' }, di::Tuple { SelectionType::Selection, U'p' },
di::Tuple { SelectionType::Selection, U's' }, di::Tuple { SelectionType::_0, U'0' },
di::Tuple { SelectionType::_1, U'1' }, di::Tuple { SelectionType::_2, U'2' },
di::Tuple { SelectionType::_3, U'3' }, di::Tuple { SelectionType::_4, U'4' },
di::Tuple { SelectionType::_5, U'5' }, di::Tuple { SelectionType::_6, U'6' },
di::Tuple { SelectionType::_7, U'7' },
}
@ Clipboard
Standard user clipboard (default)
Definition osc_52.h:9
@ _2
Definition osc_52.h:13
@ _7
Definition osc_52.h:18
@ _1
Definition osc_52.h:12
@ Selection
Primary selection clipboard.
Definition osc_52.h:10
@ _0
Numbered buffers, never forwarded to the outer terminal.
Definition osc_52.h:11
@ _4
Definition osc_52.h:15
@ _6
Definition osc_52.h:17
@ _3
Definition osc_52.h:14
@ _5
Definition osc_52.h:16
@ U
Definition key.h:30

◆ ttx_capabilities

auto ttx::terminal::ttx_capabilities
constexpr

◆ ttx_names

auto ttx::terminal::ttx_names
constexpr
Initial value:
= di::Array {
"xterm-ttx"_tsv,
"ttx"_tsv,
"ttx terminal multiplexer"_tsv,
}

◆ ttx_terminfo

auto ttx::terminal::ttx_terminfo
constexpr
Initial value:
.names = ttx_names,
.capabilities = ttx_capabilities,
}
constexpr auto ttx_names
Definition capabilities.h:6
constexpr auto ttx_capabilities
Definition capabilities.h:20
Represents a terminfo entry.
Definition capability.h:30

◆ wide_multi_cell_info

auto ttx::terminal::wide_multi_cell_info = MultiCellInfo { 1, 2 }
inlineconstexpr