Text Selection

On iOS, UITerminalView selects text inline by default: it paints a selection overlay over the terminal cells and presents the native edit menu. Mac Catalyst uses pointer selection instead.

Gestures

Override touchMenuItems(for:) and touchSelectionMenuItems(for:) in a TerminalView subclass to localize, reorder or extend the menu. The default actions carry the identifiers terminal.copy, terminal.paste, terminal.select and terminal.selectAll.

final class HostTerminalView: TerminalView {
    override func touchSelectionMenuItems(for context: TerminalTouchSelectionMenuContext) -> [UIMenuElement] {
        super.touchSelectionMenuItems(for: context) + [
            UIAction(title: "Share") { _ in share(context.selectedText) },
        ]
    }
}

Opting out

Set usesInlineTextSelection = false to turn touch selection off. A long press then does nothing and a tap only clicks and toggles the keyboard.

The long-press sheet API (TerminalTextSelectionRequest, TerminalSurfaceTextSelectionRequestDelegate, TerminalViewState.onTextSelectionRequest) has been removed.