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.
TypeScript
diff: the docked pane starts at its header, under the engine's own head row (#99206)
Alice T'Poteat765f236fe1bf
diff --git a/mods/diff/hooks/limits/sizes/pane/index.ts b/mods/diff/hooks/limits/sizes/pane/index.tsindex 20434604..f1eba31c 100644--- a/mods/diff/hooks/limits/sizes/pane/index.ts+++ b/mods/diff/hooks/limits/sizes/pane/index.ts@@ -1,6 +1,5 @@export * from './gutter-chrome.js'export * from './max-summary-rows.js'-export * from './pane-top-pad-rows.js'export * from './pre-session-body-cap.js'export * from './scroll-margin-rows.js'export * from './wheel-rows.js'diff --git a/mods/diff/hooks/limits/sizes/pane/pane-top-pad-rows.ts b/mods/diff/hooks/limits/sizes/pane/pane-top-pad-rows.tsdeleted file mode 100644index e487c318..00000000--- a/mods/diff/hooks/limits/sizes/pane/pane-top-pad-rows.ts+++ /dev/null@@ -1,5 +0,0 @@-/**- * The blank row the docked pane keeps above its header, as the built-in- * sidebar's header does (its `paddingY`).- */-export const PANE_TOP_PAD_ROWS = 1diff --git a/mods/diff/hooks/views/body/plan/body-layout-of.ts b/mods/diff/hooks/views/body/plan/body-layout-of.tsindex 3c3ae6cb..48ffb50e 100644--- a/mods/diff/hooks/views/body/plan/body-layout-of.ts+++ b/mods/diff/hooks/views/body/plan/body-layout-of.ts@@ -1,4 +1,3 @@-import Limits from '../../../limits'import type PaneState from '../../../pane-state'import type { BodyLayout, DockPlan } from '../types'import Segments from './segments'@@ -39,10 +38,7 @@ export function bodyLayoutOf(const tops = new Map<string, number>()- const visibleRows = Math.max(- 0,- model.place.rows - Limits.PANE_TOP_PAD_ROWS - headRows - listRows,- )+ const visibleRows = Math.max(0, model.place.rows - headRows - listRows)let extent = 0@@ -54,7 +50,7 @@ export function bodyLayoutOf(extent += Segments.segmentRowsOf(segment)}- const listTop = Limits.PANE_TOP_PAD_ROWS + headRows + 1+ const listTop = headRows + 1return {segments,diff --git a/mods/diff/hooks/views/inset-of/inset-of.ts b/mods/diff/hooks/views/inset-of/inset-of.tsindex 0e349553..b58cb9ed 100644--- a/mods/diff/hooks/views/inset-of/inset-of.ts+++ b/mods/diff/hooks/views/inset-of/inset-of.ts@@ -3,7 +3,10 @@ import type { Kit } from '../kit'/*** A drawing's kit inside the docked pane's padding: the built-in's blank- * last column and its blank row above the header taken off.+ * last column taken off.+ *+ * No row comes off: the blank row above the header is the engine's own,+ * the one it keeps over a docked pane's body for its close mark.** @param kit the drawing's kit at the pane's full size* @returns the kit its body draws with@@ -11,5 +14,4 @@ import type { Kit } from '../kit'export const insetOf = (kit: Kit): Kit => ({...kit,columns: Math.max(1, kit.columns - Limits.PANE_RIGHT_PAD_COLUMNS),- rows: Math.max(0, kit.rows - Limits.PANE_TOP_PAD_ROWS),})diff --git a/mods/diff/hooks/views/pane-view.tsx b/mods/diff/hooks/views/pane-view.tsxindex 96cac253..96d530ab 100644--- a/mods/diff/hooks/views/pane-view.tsx+++ b/mods/diff/hooks/views/pane-view.tsx@@ -40,11 +40,7 @@ export function paneView(seat.terminalColumns < Limits.OPEN_MIN_COLUMNSreturn isDocked ? (- <Box- flexDirection="column"- paddingTop={Limits.PANE_TOP_PAD_ROWS}- paddingRight={Limits.PANE_RIGHT_PAD_COLUMNS}- >+ <Box flexDirection="column" paddingRight={Limits.PANE_RIGHT_PAD_COLUMNS}>{sidebarPane(insetOf(kit), model)}</Box>) : isNarrow ? (diff --git a/mods/diff/tests/fixtures/index.ts b/mods/diff/tests/fixtures/index.tsindex 55efa567..c4d420a5 100644--- a/mods/diff/tests/fixtures/index.ts+++ b/mods/diff/tests/fixtures/index.ts@@ -60,6 +60,8 @@ export * from './unsaid-hint.js'export * from './usage-at.js'export * from './vs-main.js'export * from './wheel-over-list.js'+export * from './wheel-over-list-margin.js'+export * from './wheel-over-list-top.js'export * from './wheel-tick.js'export * from './with-lockfile.js'export * from './worktree'diff --git a/mods/diff/tests/fixtures/pane-view/body-rows.ts b/mods/diff/tests/fixtures/pane-view/body-rows.tsindex 5a2aa9dc..adeafe02 100644--- a/mods/diff/tests/fixtures/pane-view/body-rows.ts+++ b/mods/diff/tests/fixtures/pane-view/body-rows.ts@@ -1,4 +1,5 @@/**- * The pane's body rows in the ordinary cases: docked in a 40-row terminal.+ * The pane's body rows in the ordinary cases: docked in a 40-row terminal,+ * under the row the engine keeps for its close mark.*/-export const BODY_ROWS = 35+export const BODY_ROWS = 34diff --git a/mods/diff/tests/fixtures/pane-view/engine-head-rows.ts b/mods/diff/tests/fixtures/pane-view/engine-head-rows.tsnew file mode 100644index 00000000..a6e263e2--- /dev/null+++ b/mods/diff/tests/fixtures/pane-view/engine-head-rows.ts@@ -0,0 +1,5 @@+/**+ * The rows the engine keeps over a docked pane's body: one, blank but for+ * its close mark.+ */+export const ENGINE_HEAD_ROWS = 1diff --git a/mods/diff/tests/fixtures/pane-view/index.ts b/mods/diff/tests/fixtures/pane-view/index.tsindex 3ae59bad..907874bf 100644--- a/mods/diff/tests/fixtures/pane-view/index.ts+++ b/mods/diff/tests/fixtures/pane-view/index.ts@@ -9,6 +9,7 @@ export * from './dock-seat.js'export * from './docked-pane.js'export * from './docks-pane.js'export * from './draws-pane.js'+export * from './engine-head-rows.js'export * from './long-line-chars.js'export * from './long-path-segments.js'export * from './narrow-seat.js'diff --git a/mods/diff/tests/fixtures/wheel-over-list-margin.ts b/mods/diff/tests/fixtures/wheel-over-list-margin.tsnew file mode 100644index 00000000..a26ce25f--- /dev/null+++ b/mods/diff/tests/fixtures/wheel-over-list-margin.ts@@ -0,0 +1,12 @@+import type { UiScrollInput } from 'claude-code'++import { WHEEL_TICK } from './wheel-tick.js'++/**+ * The same wheel tick with the pointer over the blank row between the+ * docked header and its list.+ */+export const WHEEL_OVER_LIST_MARGIN: UiScrollInput = {+ ...WHEEL_TICK,+ pointer: { column: 10, row: 1 },+}diff --git a/mods/diff/tests/fixtures/wheel-over-list-top.ts b/mods/diff/tests/fixtures/wheel-over-list-top.tsnew file mode 100644index 00000000..b422d798--- /dev/null+++ b/mods/diff/tests/fixtures/wheel-over-list-top.ts@@ -0,0 +1,12 @@+import type { UiScrollInput } from 'claude-code'++import { WHEEL_TICK } from './wheel-tick.js'++/**+ * The same wheel tick with the pointer over the docked list's first row+ * (header, the list's margin, then the rows).+ */+export const WHEEL_OVER_LIST_TOP: UiScrollInput = {+ ...WHEEL_TICK,+ pointer: { column: 10, row: 2 },+}diff --git a/mods/diff/tests/fixtures/wheel-over-list.ts b/mods/diff/tests/fixtures/wheel-over-list.tsindex 80ab7b58..a4e53723 100644--- a/mods/diff/tests/fixtures/wheel-over-list.ts+++ b/mods/diff/tests/fixtures/wheel-over-list.ts@@ -4,9 +4,9 @@ import { WHEEL_TICK } from './wheel-tick.js'/*** The same wheel tick with the pointer over the docked list's third row- * (top pad, header, the list's margin, then the rows).+ * (header, the list's margin, then the rows).*/export const WHEEL_OVER_LIST: UiScrollInput = {...WHEEL_TICK,- pointer: { column: 10, row: 5 },+ pointer: { column: 10, row: 4 },}diff --git a/mods/diff/tests/views/pane-view.test.ts b/mods/diff/tests/views/pane-view.test.tsindex 3a1b82bb..45df8913 100644--- a/mods/diff/tests/views/pane-view.test.ts+++ b/mods/diff/tests/views/pane-view.test.ts@@ -365,7 +365,7 @@ describe('pane-view', () => {expect(Fixtures.jsonOf(reversed)).not.toContain('')})- test("docked: the built-in's blank top row, last column", async ($, on) => {+ test("docked: no top pad, the built-in's last column", async ($, on) => {const tree = await Fixtures.dockedPane($,on,@@ -381,16 +381,55 @@ describe('pane-view', () => {expect(tree).toMatchObject({type: 'Box',- props: {- paddingTop: Limits.PANE_TOP_PAD_ROWS,- paddingRight: Limits.PANE_RIGHT_PAD_COLUMNS,- },+ props: { paddingRight: Limits.PANE_RIGHT_PAD_COLUMNS },})+ expect(Fixtures.jsonOf(tree)).not.toContain('"paddingTop"')expect(Fixtures.stringsOf(tree)).toContain(rule)expect(Fixtures.stringsOf(tree)).not.toContain(`${rule}─`)})+ test('docked: the window takes every row under the list', () => {+ const files = [Fixtures.rowOf('src/a.ts'), Fixtures.rowOf('b.ts')]+ const headerRows = 1+ const listMarginRows = 1++ const model = modelOf({+ data: dataOf(files),+ place: { ...Fixtures.WHOLE_PLACE, rows: Fixtures.BODY_ROWS },+ })++ const listTop = headerRows + listMarginRows+ const listEnd = listTop + files.length++ expect(Views.bodyLayoutOf(model, Views.dockPlanOf(model))).toMatchObject({+ listTop,+ listEnd,+ visibleRows: Fixtures.BODY_ROWS - listEnd - listMarginRows,+ })+ })++ test('docked: the list takes the wheel from its first row', () => {+ const model = modelOf({+ data: dataOf(+ Array.from({ length: Limits.MAX_SUMMARY_ROWS + 1 }, (_, index) =>+ Fixtures.rowOf(`file${index}.ts`),+ ),+ ),+ place: { ...Fixtures.WHOLE_PLACE, rows: Fixtures.BODY_ROWS },+ })++ expect(+ Views.isWheelOverList(model, Fixtures.WHEEL_OVER_LIST_MARGIN),+ 'the blank row under the header',+ ).toBe(false)++ expect(+ Views.isWheelOverList(model, Fixtures.WHEEL_OVER_LIST_TOP),+ "the list's first row",+ ).toBe(true)+ })+test("docked rows follow the built-in's, its hunks after", async ($, on) => {expect(Fixtures.rowShapesOf(@@ -428,11 +467,9 @@ describe('pane-view', () => {const [header, pad, middle, foot, ...more] = Fixtures.childrenOf(body)const [spacer, headline, ...under] = Fixtures.childrenOf(middle)- const aboveMiddle = Limits.PANE_TOP_PAD_ROWS + 2+ const aboveMiddle = Fixtures.ENGINE_HEAD_ROWS + 2- expect(body).toMatchObject({- props: { height: Fixtures.BODY_ROWS - Limits.PANE_TOP_PAD_ROWS },- })+ expect(body).toMatchObject({ props: { height: Fixtures.BODY_ROWS } })expect(Fixtures.stringsOf(header)).toEqual([])expect(Fixtures.jsonOf(header)).not.toContain('✕')