select method

bool select(
  1. FlarkSelection selection
)

Implementation

bool select(FlarkSelection selection) {
  final current = snapshot;
  final next = switch (current) {
    FlarkLiveSnapshot(:final document) => FlarkLiveSnapshot._(
      document.withSelection(selection),
    ),
    FlarkSourceSnapshot() => current._withSelection(selection),
  };
  if (next.selection == current.selection) return false;
  _snapshot = next;
  _revision++;
  return true;
}