clipboard

package
v2.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(m Method) error

Initialize attempts to initialize the clipboard using the given method

func Read

func Read(r Register) (string, error)

Read reads from a clipboard register

func ReadMulti

func ReadMulti(r Register, num, ncursors int) (string, error)

ReadMulti reads text from a clipboard register for a certain multi-cursor

func ValidMulti

func ValidMulti(r Register, clip string, ncursors int) bool

ValidMulti checks if the internal multi-clipboard is valid and up-to-date with the system clipboard

func Write

func Write(text string, r Register) error

Write writes text to a clipboard register

func WriteMulti

func WriteMulti(text string, r Register, num int, ncursors int) error

WriteMulti writes text to a clipboard register for a certain multi-cursor

Types

type Method

type Method int
const (
	// External relies on external tools for accessing the clipboard
	// These include xclip, xsel, wl-clipboard for linux, pbcopy/pbpaste on Mac,
	// and Syscalls on Windows.
	External Method = iota
	// Terminal uses the terminal to manage the clipboard via OSC 52. Many
	// terminals do not support OSC 52, in which case this method won't work.
	Terminal
	// Internal just manages the clipboard with an internal buffer and doesn't
	// attempt to interface with the system clipboard
	Internal
)
var CurrentMethod Method = Internal

CurrentMethod is the method used to store clipboard information

func SetMethod

func SetMethod(m string) Method

SetMethod changes the clipboard access method

type Register

type Register int

A Register is a buffer used to store text. The system clipboard has the 'clipboard' and 'primary' (linux-only) registers, but other registers may be used internal to micro.

const (
	// ClipboardReg is the main system clipboard
	ClipboardReg Register = -1
	// PrimaryReg is the system primary clipboard (linux only)
	PrimaryReg = -2
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL