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.

627 B
Raw Blame
import type { RefObject } from 'react'
import type { TextInput } from 'react-native'
import type { TerminalLiveInputSelection } from './terminal-live-text-commit'

// RN Web refs are input/textarea nodes; reject future wrapper shapes before writing value.
export function writeTerminalLiveInputText(
  ref: RefObject<TextInput | null>,
  text: string,
  selection?: TerminalLiveInputSelection
): void {
  const node = ref.current
  if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement) {
    node.value = text
    if (selection) {
      node.setSelectionRange(selection.start, selection.end)
    }
  }
}