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 / is-wheel-over-list.ts
28 lines · 826 BRaw
1import type { UiScrollInput } from 'claude-code'
2
3import Limits from '../../limits'
4import type PaneState from '../../pane-state'
5import Plan from './plan'
6
7/**
8 * Whether a scroll is a wheel tick over the docked list block while the
9 * list overflows its window: it moves the list then, as ReplDiffSidebar's.
10 *
11 * @param model the pane's state
12 * @param scroll the move: the cell the wheel was over, absent for keys
13 * @returns whether the list takes it
14 */
15export function isWheelOverList(
16 model: PaneState.PaneModel,
17 scroll: Pick<UiScrollInput, 'pointer'>,
18): boolean {
19 const plan = Plan.dockPlanOf(model)
20 const { listTop, listEnd } = Plan.bodyLayoutOf(model, plan)
21 const row = scroll.pointer?.row ?? -1
22
23 return (
24 row >= listTop &&
25 row < listEnd &&
26 plan.rows.length > Limits.MAX_SUMMARY_ROWS
27 )
28}