Raxol.Terminal.ClipboardBehaviour behaviour (Raxol v0.5.0)

View Source

Defines the behaviour for clipboard operations in the terminal.

This behaviour specifies the callbacks that must be implemented by any module that wants to handle clipboard operations in the terminal emulator.

Summary

Callbacks

Clears the clipboard content.

Gets the current content of the clipboard.

Gets the current selection content.

Sets the content of the clipboard.

Sets the selection content.

Callbacks

clear(clipboard)

@callback clear(clipboard :: term()) :: {:ok, term()} | {:error, term()}

Clears the clipboard content.

Returns {:ok, updated_clipboard} on success, or {:error, reason} on failure.

get_content(clipboard)

@callback get_content(clipboard :: term()) :: {:ok, String.t()} | {:error, term()}

Gets the current content of the clipboard.

Returns {:ok, content} on success, or {:error, reason} on failure.

get_selection(clipboard)

@callback get_selection(clipboard :: term()) :: {:ok, String.t()} | {:error, term()}

Gets the current selection content.

Returns {:ok, content} on success, or {:error, reason} on failure.

set_content(clipboard, content)

@callback set_content(clipboard :: term(), content :: String.t()) ::
  {:ok, term()} | {:error, term()}

Sets the content of the clipboard.

Returns {:ok, updated_clipboard} on success, or {:error, reason} on failure.

set_selection(clipboard, content)

@callback set_selection(clipboard :: term(), content :: String.t()) ::
  {:ok, term()} | {:error, term()}

Sets the selection content.

Returns {:ok, updated_clipboard} on success, or {:error, reason} on failure.