Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

565 B
Raw Blame
/** Keep input inserted while a submitted snapshot was in flight; other edits keep the whole draft. */
export function textLeftAfterSubmission(
  current: string,
  submitted: string
): { text: string; from: number; to: number } | null {
  let from = 0
  while (from < submitted.length && submitted[from] === current[from]) {
    from++
  }
  const rest = submitted.slice(from)
  if (current.length < submitted.length || !current.endsWith(rest)) {
    return null
  }
  const to = current.length - rest.length
  return { text: current.slice(from, to), from, to }
}