Documentation ¶
Overview ¶
OSC52 is a terminal escape sequence that allows copying text to the clipboard.
The sequence consists of the following:
OSC 52 ; Pc ; Pd BEL
Pc is the clipboard choice:
c: clipboard p: primary q: secondary (not supported) s: select (not supported) 0-7: cut-buffers (not supported)
Pd is the data to copy to the clipboard. This string should be encoded in base64 (RFC-4648).
If Pd is "?", the terminal replies to the host with the current contents of the clipboard.
If Pd is neither a base64 string nor "?", the terminal clears the clipboard.
See https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands where Ps = 52 => Manipulate Selection Data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶
func Copy(str string)
Copy copies the OSC52 string to the output. This uses the system clipboard buffer.
func CopyClipboard ¶ added in v1.2.0
CopyClipboard copies the OSC52 string to the output. This uses the passed clipboard buffer.
func CopyPrimary ¶ added in v1.2.0
func CopyPrimary(str string)
CopyPrimary copies the OSC52 string to the output. This uses the primary clipboard buffer.
Types ¶
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
Output is where the OSC52 string should be written.
func DefaultOutput ¶ added in v1.2.0
func DefaultOutput() *Output
DefaultOutput returns the default output for Copy.
func (*Output) Copy ¶
Copy copies the OSC52 string to the output. This uses the system clipboard buffer.
func (*Output) CopyClipboard ¶ added in v1.2.0
CopyClipboard copies the OSC52 string to the output. This uses the passed clipboard buffer.
func (*Output) CopyPrimary ¶ added in v1.2.0
CopyPrimary copies the OSC52 string to the output. This uses the primary clipboard buffer.