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 / views / body / place-at-file.ts
20 lines · 553 BRaw
1import type PaneState from '../../pane-state'
2import Plan from './plan'
3
4/**
5 * The docked pane's place with the body scrolled so this file's block
6 * heads the window (the built-in's jump to file); unchanged for no such file.
7 *
8 * @param model the pane's state
9 * @param path the file's path
10 * @returns the place
11 */
12export const placeAtFile = (
13 model: PaneState.PaneModel,
14 path: string,
15): PaneState.PaneModel['place'] => ({
16 ...model.place,
17 top:
18 Plan.bodyLayoutOf(model, Plan.dockPlanOf(model)).tops.get(path) ??
19 model.place.top,
20})