Clipboard is the clipboard buffer to use.
type Clipboard rune
const ( // SystemClipboard is the system clipboard buffer. SystemClipboard Clipboard = 'c' // PrimaryClipboard is the primary clipboard buffer (X11). PrimaryClipboard = 'p' )
Mode is the mode to use for the OSC52 sequence.
type Mode uint
const ( // DefaultMode is the default OSC52 sequence mode. DefaultMode Mode = iota // ScreenMode escapes the OSC52 sequence for screen using DCS sequences. ScreenMode // TmuxMode escapes the OSC52 sequence for tmux. Not needed if tmux // clipboard is set to `set-clipboard on` TmuxMode )
Operation is the OSC52 operation.
type Operation uint
const ( // SetOperation is the copy operation. SetOperation Operation = iota // QueryOperation is the query operation. QueryOperation // ClearOperation is the clear operation. ClearOperation )
Sequence is the OSC52 sequence.
type Sequence struct {
// contains filtered or unexported fields
}
func Clear() Sequence
Clear creates a new OSC52 sequence with the ClearOperation. This returns a new OSC52 sequence to clear the clipboard.
This is a syntactic sugar for New().Clear().
func New(strs ...string) Sequence
New creates a new OSC52 sequence with the given string(s). Strings are joined with a space character.
func Query() Sequence
Query creates a new OSC52 sequence with the QueryOperation. This returns a new OSC52 sequence to query the clipboard contents.
This is a syntactic sugar for New().Query().
func (s Sequence) Clear() Sequence
Clear sets the operation to ClearOperation. This clears the clipboard.
This is a syntactic sugar for s.Operation(ClearOperation).
func (s Sequence) Clipboard(c Clipboard) Sequence
Clipboard sets the clipboard buffer for the OSC52 sequence.
func (s Sequence) Limit(l int) Sequence
Limit sets the limit for the OSC52 sequence. The default limit is 0 (no limit).
Strings longer than the limit get ignored. Settting the limit to 0 or a negative value disables the limit. Each terminal defines its own escapse sequence limit.
func (s Sequence) Mode(m Mode) Sequence
Mode sets the mode for the OSC52 sequence.
func (s Sequence) Operation(o Operation) Sequence
Operation sets the operation for the OSC52 sequence. The default operation is SetOperation.
func (s Sequence) Primary() Sequence
Primary sets the clipboard buffer to PrimaryClipboard. This is the X11 primary clipboard.
This is a syntactic sugar for s.Clipboard(PrimaryClipboard).
func (s Sequence) Query() Sequence
Query sets the operation to QueryOperation. This queries the clipboard contents.
This is a syntactic sugar for s.Operation(QueryOperation).
func (s Sequence) Screen() Sequence
Screen sets the mode to ScreenMode. Used to escape the OSC52 sequence for `screen`.
This is a syntactic sugar for s.Mode(ScreenMode).
func (s Sequence) SetString(strs ...string) Sequence
SetString sets the string for the OSC52 sequence. Strings are joined with a space character.
func (s Sequence) String() string
String returns the OSC52 sequence.
func (s Sequence) Tmux() Sequence
Tmux sets the mode to TmuxMode. Used to escape the OSC52 sequence for `tmux`.
Note: this is not needed if tmux clipboard is set to `set-clipboard on`. If TmuxMode is used, tmux must have `allow-passthrough on` set.
This is a syntactic sugar for s.Mode(TmuxMode).
func (s Sequence) WriteTo(out io.Writer) (int64, error)
WriteTo writes the OSC52 sequence to the writer.