spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / diff / hooks / pane-state / picked-turn-of / picked-turn-of.ts
16 lines · 544 BRaw
1import type Turns from '../../turns'
2import type { PaneModel } from '../pane-model'
3
4/**
5 * The turn the pane's source names while the transcript still holds it;
6 * undefined for the current source or a turn a rewind dropped.
7 *
8 * @param model the pane's state
9 * @returns the picked turn, or undefined
10 */
11export function pickedTurnOf(model: PaneModel): Turns.TurnDiff | undefined {
12 const { source } = model
13 const wanted = source.kind === 'turn' ? source.index : null
14
15 return model.turns.find(candidate => candidate.index === wanted)
16}