defaultCopyAction function

void defaultCopyAction(
  1. TerminalEngine engine
)

Reads the engine's selection text and writes it to the system clipboard. Used as the default Copy action so a TerminalView with no host wiring still performs the natural Ctrl+Shift+C.

Implementation

void defaultCopyAction(TerminalEngine engine) {
  final text = engine.selectionText();
  if (text != null && text.isNotEmpty) {
    Clipboard.setData(ClipboardData(text: text));
  }
}