ghosttyTerminalNotifySelectionChange<SelectionT> function

void ghosttyTerminalNotifySelectionChange<SelectionT>({
  1. required SelectionT? previousSelection,
  2. required SelectionT? nextSelection,
  3. required String resolveText(
    1. SelectionT selection
    ),
  4. required void onSelectionChanged(
    1. SelectionT? selection
    )?,
  5. required void onSelectionContentChanged(
    1. GhosttyTerminalSelectionContent<SelectionT>? content
    )?,
})

Emits shared terminal selection callbacks and derived content payloads.

Implementation

void ghosttyTerminalNotifySelectionChange<SelectionT>({
  required SelectionT? previousSelection,
  required SelectionT? nextSelection,
  required String Function(SelectionT selection) resolveText,
  required void Function(SelectionT? selection)? onSelectionChanged,
  required void Function(GhosttyTerminalSelectionContent<SelectionT>? content)?
  onSelectionContentChanged,
}) {
  if (previousSelection == nextSelection) {
    return;
  }
  onSelectionChanged?.call(nextSelection);
  ghosttyTerminalNotifySelectionContent<SelectionT>(
    selection: nextSelection,
    resolveText: resolveText,
    onSelectionContentChanged: onSelectionContentChanged,
  );
}