Function paste

Source
pub fn paste() -> Cmd
Expand description

Creates a command that retrieves text from the system clipboard.

This command reads the current clipboard contents and sends a paste message that can be handled by the text input’s update() method.

§Returns

A Cmd that will attempt to read from clipboard and send either:

  • PasteMsg(String) with the clipboard contents on success
  • PasteErrMsg(String) with an error message on failure

§Examples

use bubbletea_widgets::textinput::paste;

// This is typically called internally when Ctrl+V is pressed
// but can be used manually:
let paste_cmd = paste();

§Errors

The returned command may produce a PasteErrMsg if:

  • The clipboard is not accessible
  • The clipboard contains non-text data
  • System clipboard permissions are denied