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

diff: the rows' widths and reserves live under limits, sparing six of the files a hooks module may linkBrowse files
poteat authored on Sep 13, 2026 parent 01e6ae4 · commit 78c94cecbda0
25 changed files+47 -64compared with 01e6ae4
Amods/diff/hooks/limits/columns/dialog-path-reserve.ts
Mmods/diff/hooks/limits/columns/index.ts
Amods/diff/hooks/limits/columns/path-floor.ts
Amods/diff/hooks/limits/columns/stat-cells.ts
Amods/diff/hooks/limits/dialog-path-floor.ts
Mmods/diff/hooks/limits/index.ts
Amods/diff/hooks/limits/todo-bar-cells.ts
Amods/diff/hooks/limits/todo-bar-reserve.ts
Mmods/diff/hooks/views/sections/dialog-file-row/dialog-file-row.tsx
Dmods/diff/hooks/views/sections/dialog-path-floor/dialog-path-floor.ts
Dmods/diff/hooks/views/sections/dialog-path-floor/index.ts
Dmods/diff/hooks/views/sections/dialog-path-reserve/dialog-path-reserve.ts
Dmods/diff/hooks/views/sections/dialog-path-reserve/index.ts
Mmods/diff/hooks/views/sections/file-row/file-row.ts
Mmods/diff/hooks/views/sections/index.ts
Mmods/diff/hooks/views/sections/legend-row.tsx
Dmods/diff/hooks/views/sections/path-floor/index.ts
Dmods/diff/hooks/views/sections/path-floor/path-floor.ts
Dmods/diff/hooks/views/sections/stat-cells/index.ts
Dmods/diff/hooks/views/sections/stat-cells/stat-cells.ts
Dmods/diff/hooks/views/sections/todo-bar-cells/index.ts
Dmods/diff/hooks/views/sections/todo-bar-cells/todo-bar-cells.ts
Dmods/diff/hooks/views/sections/todo-bar-reserve/index.ts
Dmods/diff/hooks/views/sections/todo-bar-reserve/todo-bar-reserve.ts
Mmods/diff/hooks/views/sections/todo-bar.tsx
@@ -1,0 +1,5 @@
1+/**
2+ * The cells an inline file row keeps off its path (DiffFileList's 16 for
3+ * the counts, 3 for the pointer, 4 for the frame).
4+ */
5+export const DIALOG_PATH_RESERVE = 23
@@ -1,6 +1,9 @@
11 export * from './auto-open-min-columns.js'
2+export * from './dialog-path-reserve.js'
23 export * from './open-min-columns.js'
34 export * from './pane-right-pad-columns.js'
5+export * from './path-floor.js'
6+export * from './stat-cells.js'
47 export * from './widest-bucket-columns.js'
58
69 export * as default from '.'
@@ -1,0 +1,5 @@
1+/**
2+ * The fewest cells a docked file row gives its path, however narrow the
3+ * pane (ReplDiffSidebar's 8).
4+ */
5+export const PATH_FLOOR = 8
@@ -1,0 +1,5 @@
1+/**
2+ * The cells a docked file row keeps for its `+N -M` (ReplDiffSidebar's 12):
3+ * the path is cut from its start to the rest.
4+ */
5+export const STAT_CELLS = 12
@@ -1,0 +1,5 @@
1+/**
2+ * The fewest cells an inline file row gives its path, however narrow the
3+ * pane (DiffFileList's 20).
4+ */
5+export const DIALOG_PATH_FLOOR = 20
@@ -1,5 +1,8 @@
11 export * from './columns'
2+export * from './dialog-path-floor.js'
23 export * from './sizes'
34 export * from './timing'
5+export * from './todo-bar-cells.js'
6+export * from './todo-bar-reserve.js'
47
58 export * as default from '.'
@@ -1,0 +1,4 @@
1+/**
2+ * The widest the todo progress bar draws (ReplDiffSidebar's 20).
3+ */
4+export const TODO_BAR_CELLS = 20
@@ -1,0 +1,4 @@
1+/**
2+ * The cells kept beside the todo bar for its `done/total` count.
3+ */
4+export const TODO_BAR_RESERVE = 12
@@ -3,10 +3,9 @@
33 /* @jsxFrag Fragment */
44 import type { RenderElement } from 'claude-code'
55
6+import Limits from '../../../limits'
67 import type { Kit } from '../../kit'
78 import Layout from '../../layout'
8-import { DIALOG_PATH_FLOOR } from '../dialog-path-floor'
9-import { DIALOG_PATH_RESERVE } from '../dialog-path-reserve'
109 import { diffStat } from '../diff-stat'
1110 import type { FileRowModel } from '../file-row-model'
1211 import { listRow } from '../list-row'
@@ -27,7 +26,12 @@
2726 onPress: () => void,
2827 ): RenderElement {
2928 const { Text } = kit.ui
30- const room = Math.max(DIALOG_PATH_FLOOR, kit.columns - DIALOG_PATH_RESERVE)
29+
30+ const room = Math.max(
31+ Limits.DIALOG_PATH_FLOOR,
32+ kit.columns - Limits.DIALOG_PATH_RESERVE,
33+ )
34+
3135 const mark = row.isSelected ? POINTER : ' '
3236 const name = Layout.truncateStart(Layout.sanitizeName(row.displayPath), room)
3337
Dmods/diff/hooks/views/sections/dialog-path-floor/dialog-path-floor.ts+0 -5
@@ -1,5 +1,0 @@
1-/**
2- * The fewest cells an inline file row gives its path, however narrow the
3- * pane (DiffFileList's 20).
4- */
5-export const DIALOG_PATH_FLOOR = 20
Dmods/diff/hooks/views/sections/dialog-path-floor/index.ts+0 -3
@@ -1,3 +1,0 @@
1-export * from './dialog-path-floor.js'
2-
3-export * as default from '.'
Dmods/diff/hooks/views/sections/dialog-path-reserve/dialog-path-reserve.ts+0 -5
@@ -1,5 +1,0 @@
1-/**
2- * The cells an inline file row keeps off its path (DiffFileList's 16 for
3- * the counts, 3 for the pointer, 4 for the frame).
4- */
5-export const DIALOG_PATH_RESERVE = 23
Dmods/diff/hooks/views/sections/dialog-path-reserve/index.ts+0 -3
@@ -1,3 +1,0 @@
1-export * from './dialog-path-reserve.js'
2-
3-export * as default from '.'
@@ -1,12 +1,11 @@
11 import type { RenderElement } from 'claude-code'
22
3+import Limits from '../../../limits'
34 import type { Kit } from '../../kit'
45 import Layout from '../../layout'
56 import { diffStat } from '../diff-stat'
67 import type { FileRowModel } from '../file-row-model'
78 import { listRow } from '../list-row'
8-import { PATH_FLOOR } from '../path-floor'
9-import { STAT_CELLS } from '../stat-cells'
109 import { statTextOf } from '../stat-text-of'
1110
1211 /**
@@ -29,7 +28,7 @@
2928 const label = Layout.padEnd(
3029 Layout.truncateStart(
3130 Layout.sanitizeName(row.displayPath),
32- Math.max(kit.columns - STAT_CELLS, PATH_FLOOR),
31+ Math.max(kit.columns - Limits.STAT_CELLS, Limits.PATH_FLOOR),
3332 ),
3433 kit.columns - statTextOf(row.added, row.removed).length,
3534 )
@@ -1,7 +1,5 @@
11 export * from './ask-key-of'
22 export * from './dialog-file-row'
3-export * from './dialog-path-floor'
4-export * from './dialog-path-reserve'
53 export * from './diff-stat'
64 export * from './dim-note'
75 export * from './divider.jsx'
@@ -14,17 +12,13 @@
1412 export * from './list-edge-button'
1513 export * from './list-row'
1614 export * from './name-row'
17-export * from './path-floor'
1815 export * from './pointer'
1916 export * from './present'
2017 export * from './pressable'
2118 export * from './source-picker.jsx'
22-export * from './stat-cells'
2319 export * from './stat-text-of'
2420 export * from './title-row.jsx'
2521 export * from './todo-bar.jsx'
26-export * from './todo-bar-cells'
27-export * from './todo-bar-reserve'
2822 export * from './toggle-row.jsx'
2923
3024 export * as default from '.'
@@ -3,12 +3,11 @@
33 /* @jsxFrag Fragment */
44 import type { RenderElement } from 'claude-code'
55
6+import Limits from '../../limits'
67 import type Entries from '../entries'
78 import type { Kit } from '../kit'
89 import Layout from '../layout'
910 import { diffStat } from './diff-stat'
10-import { PATH_FLOOR } from './path-floor'
11-import { STAT_CELLS } from './stat-cells'
1211
1312 /**
1413 * One row of the open pre-session section's legend (PreSessionSection): the
@@ -27,7 +26,7 @@
2726 <Text dimColor wrap="truncate-end">
2827 {Layout.truncateStart(
2928 Layout.sanitizeName(entry.displayPath),
30- Math.max(kit.columns - STAT_CELLS, PATH_FLOOR),
29+ Math.max(kit.columns - Limits.STAT_CELLS, Limits.PATH_FLOOR),
3130 )}
3231 </Text>,
3332 <Box flexGrow={1} />,
Dmods/diff/hooks/views/sections/path-floor/index.ts+0 -3
@@ -1,3 +1,0 @@
1-export * from './path-floor.js'
2-
3-export * as default from '.'
Dmods/diff/hooks/views/sections/path-floor/path-floor.ts+0 -5
@@ -1,5 +1,0 @@
1-/**
2- * The fewest cells a docked file row gives its path, however narrow the
3- * pane (ReplDiffSidebar's 8).
4- */
5-export const PATH_FLOOR = 8
Dmods/diff/hooks/views/sections/stat-cells/index.ts+0 -3
@@ -1,3 +1,0 @@
1-export * from './stat-cells.js'
2-
3-export * as default from '.'
Dmods/diff/hooks/views/sections/stat-cells/stat-cells.ts+0 -5
@@ -1,5 +1,0 @@
1-/**
2- * The cells a docked file row keeps for its `+N -M` (ReplDiffSidebar's 12):
3- * the path is cut from its start to the rest.
4- */
5-export const STAT_CELLS = 12
Dmods/diff/hooks/views/sections/todo-bar-cells/index.ts+0 -3
@@ -1,3 +1,0 @@
1-export * from './todo-bar-cells.js'
2-
3-export * as default from '.'
Dmods/diff/hooks/views/sections/todo-bar-cells/todo-bar-cells.ts+0 -4
@@ -1,4 +1,0 @@
1-/**
2- * The widest the todo progress bar draws (ReplDiffSidebar's 20).
3- */
4-export const TODO_BAR_CELLS = 20
Dmods/diff/hooks/views/sections/todo-bar-reserve/index.ts+0 -3
@@ -1,3 +1,0 @@
1-export * from './todo-bar-reserve.js'
2-
3-export * as default from '.'
Dmods/diff/hooks/views/sections/todo-bar-reserve/todo-bar-reserve.ts+0 -4
@@ -1,4 +1,0 @@
1-/**
2- * The cells kept beside the todo bar for its `done/total` count.
3- */
4-export const TODO_BAR_RESERVE = 12
@@ -3,10 +3,9 @@
33 /* @jsxFrag Fragment */
44 import type { RenderElement } from 'claude-code'
55
6+import Limits from '../../limits'
67 import type PaneState from '../../pane-state'
78 import type { Kit } from '../kit'
8-import { TODO_BAR_CELLS } from './todo-bar-cells'
9-import { TODO_BAR_RESERVE } from './todo-bar-reserve'
109
1110 /**
1211 * The session's todo progress as a bar and `done/total`, drawn only while
@@ -30,7 +29,7 @@
3029
3130 const cells = Math.max(
3231 1,
33- Math.min(TODO_BAR_CELLS, kit.columns - TODO_BAR_RESERVE),
32+ Math.min(Limits.TODO_BAR_CELLS, kit.columns - Limits.TODO_BAR_RESERVE),
3433 )
3534
3635 const filled = Math.round((todos.done / todos.total) * cells)