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 / tests / fixtures / pane-view / row-shape-of.ts
18 lines · 611 BRaw
1import Tree from '../tree'
2
3/**
4 * A pane row as the layout tests read it: `blank` for a bare one-row Box,
5 * `rule` for a line of rule characters, else its first label or its strings.
6 *
7 * @param node a row of the pane's body
8 * @returns the row's shape
9 */
10export function rowShapeOf(node: unknown) {
11 const text = Tree.jsonOf(node)
12 const strings = Tree.stringsOf(node).join('')
13 const label = /"label":"([^"]*)"/.exec(text)?.[1]
14 const isBlank = text === '{"type":"Box","props":{"height":1}}'
15 const isRule = /^─+$/.test(strings)
16
17 return isBlank ? 'blank' : isRule ? 'rule' : (label ?? strings)
18}