Loading [MathJax]/jax/output/HTML-CSS/config.js
ttx 0.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ttx::terminal::OSC52 Struct Reference

Represents an OSC 52 sequence, which allows for modifying or querying the clipboard. More...

#include <ttx/terminal/escapes/osc_52.h>

Public Member Functions

auto serialize () const -> di::String
 
auto operator== (OSC52 const &other) const -> bool=default
 

Static Public Member Functions

static auto parse (di::StringView data) -> di::Optional< OSC52 >
 

Public Attributes

di::StaticVector< SelectionType, di::Constexpr< usize(SelectionType::Max)> > selections {}
 
di::Base64 data
 
bool query { false }
 

Friends

constexpr friend auto tag_invoke (di::Tag< di::reflect >, di::InPlaceType< OSC52 >)
 

Detailed Description

Represents an OSC 52 sequence, which allows for modifying or querying the clipboard.

Although xterm originally specified 10 different selection types (c,p,q,s,0-7), modern terminals only support 'c' and 'p' (clipboard and primary selection), with 's' being mapped directly to 'p'. 'c' is the primary clipboard users expect to interact with, and is the default. Note this differs from xterm which says the default clipboard is "s 0".

Some terminals will ignore requests to the other selection types (kitty), while others map all other types to 'c' (ghostty). Some terminals also only implementing writing the clipboard, not reading (wezterm). Additionally terminals may have a user-provided setting to opt-out of clipboard functionality. In this case, the terminal should always return an empty selection but we have handle our requests getting ignored.

Therefore, when parsing OSC 52 messages, we must map the selection types appropriately instead of just passing them through. Also, we will reserve the numbered buffers for selections which are local to the ttx instance (handled fully internally). This will prove useful later, and is easy implement, because we need to have a internal clipboard anyway to handle terminals which don't support OSC 52 at all.

OSC 52 is specified here.

Member Function Documentation

◆ operator==()

auto ttx::terminal::OSC52::operator== ( OSC52 const & other) const -> bool=default
default

◆ parse()

auto ttx::terminal::OSC52::parse ( di::StringView data) -> di::Optional<OSC52>
static

◆ serialize()

auto ttx::terminal::OSC52::serialize ( ) const -> di::String

Friends And Related Symbol Documentation

◆ tag_invoke

friend auto tag_invoke ( di::Tag< di::reflect > ,
di::InPlaceType< OSC52 >  )
friend

Member Data Documentation

◆ data

di::Base64 ttx::terminal::OSC52::data

◆ query

bool ttx::terminal::OSC52::query { false }

◆ selections

di::StaticVector<SelectionType, di::Constexpr<usize(SelectionType::Max)> > ttx::terminal::OSC52::selections {}

The documentation for this struct was generated from the following files: