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
| 1 | import type Git from '../git' |
| 2 | import Limits from '../limits' |
| 3 | import PaneState from '../pane-state' |
| 4 | import Views from '../views' |
| 5 | |
| 6 | /** |
| 7 | * The files whose bodies the pane draws or a press opens: every row its |
| 8 | * seat lists now. |
| 9 | * |
| 10 | * Docked, the listed session rows, then the pre-session rows while their |
| 11 | * section is open, none past PRE_SESSION_BODY_CAP. Inline, the rows in the |
| 12 | * dialog's window, none for a turn, whose rows carry their own bodies. |
| 13 | * |
| 14 | * @param model the pane's state: its fetch, its seat, its toggles, its pick |
| 15 | * @returns the rows, none without a fetch |
| 16 | */ |
| 17 | export function drawnFilesOf( |
| 18 | model: PaneState.PaneModel, |
| 19 | ): readonly Git.FileStat[] { |
| 20 | const files = model.data?.files ?? [] |
| 21 | |
| 22 | if (model.placement === 'inline') { |
| 23 | const isTurn = PaneState.pickedTurnOf(model) !== undefined |
| 24 | const listed = Views.dialogEntriesOf(model).map(entry => entry.path) |
| 25 | const start = Views.dialogWindowOf(model, listed) |
| 26 | const windowed = listed.slice(start, start + Limits.MAX_VISIBLE_FILES) |
| 27 | |
| 28 | return files.filter(file => !isTurn && windowed.includes(file.path)) |
| 29 | } |
| 30 | |
| 31 | const partition = PaneState.partitionOf( |
| 32 | files, |
| 33 | model.isNoiseShown ? 'shown' : 'hidden', |
| 34 | ) |
| 35 | |
| 36 | const isBodied = |
| 37 | model.isPreSessionShown && |
| 38 | partition.preSession.length <= Limits.PRE_SESSION_BODY_CAP |
| 39 | |
| 40 | return [...partition.shown, ...(isBodied ? partition.preSession : [])] |
| 41 | } |