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-toggle / pane-toggle-of.ts
14 lines · 547 BRaw
1import type { PaneBelief } from './pane-belief'
2
3/**
4 * What `/diff` does, the one place its toggle is decided: close only when
5 * the plugin opened the pane and it still draws; otherwise open, focused.
6 *
7 * The person's `[x]` raises nothing a plugin sees, so a pane believed
8 * open is probed with a redraw first.
9 *
10 * @param pane the plugin's belief and the probe's answer
11 * @returns `close` or `open`
12 */
13export const paneToggleOf = (pane: PaneBelief): 'open' | 'close' =>
14 pane.isBelievedOpen && pane.wasDrawnWhenProbed ? 'close' : 'open'