Skip to content

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 rows' widths and reserves live under limits, sparing six of the files a hooks module may link

poteat78c94cecbda0
diff --git a/mods/diff/hooks/views/sections/dialog-path-reserve/dialog-path-reserve.ts b/mods/diff/hooks/limits/columns/dialog-path-reserve.ts
similarity index 100%
rename from mods/diff/hooks/views/sections/dialog-path-reserve/dialog-path-reserve.ts
rename to mods/diff/hooks/limits/columns/dialog-path-reserve.ts
diff --git a/mods/diff/hooks/limits/columns/index.ts b/mods/diff/hooks/limits/columns/index.ts
index fc8fb2d9..6b8ddd35 100644
--- a/mods/diff/hooks/limits/columns/index.ts
+++ b/mods/diff/hooks/limits/columns/index.ts
@@ -1,6 +1,9 @@
export * from './auto-open-min-columns.js'
+export * from './dialog-path-reserve.js'
export * from './open-min-columns.js'
export * from './pane-right-pad-columns.js'
+export * from './path-floor.js'
+export * from './stat-cells.js'
export * from './widest-bucket-columns.js'
export * as default from '.'
diff --git a/mods/diff/hooks/views/sections/path-floor/path-floor.ts b/mods/diff/hooks/limits/columns/path-floor.ts
similarity index 100%
rename from mods/diff/hooks/views/sections/path-floor/path-floor.ts
rename to mods/diff/hooks/limits/columns/path-floor.ts
diff --git a/mods/diff/hooks/views/sections/stat-cells/stat-cells.ts b/mods/diff/hooks/limits/columns/stat-cells.ts
similarity index 100%
rename from mods/diff/hooks/views/sections/stat-cells/stat-cells.ts
rename to mods/diff/hooks/limits/columns/stat-cells.ts
diff --git a/mods/diff/hooks/views/sections/dialog-path-floor/dialog-path-floor.ts b/mods/diff/hooks/limits/dialog-path-floor.ts
similarity index 100%
rename from mods/diff/hooks/views/sections/dialog-path-floor/dialog-path-floor.ts
rename to mods/diff/hooks/limits/dialog-path-floor.ts
diff --git a/mods/diff/hooks/limits/index.ts b/mods/diff/hooks/limits/index.ts
index 87c57389..c5f06d81 100644
--- a/mods/diff/hooks/limits/index.ts
+++ b/mods/diff/hooks/limits/index.ts
@@ -1,5 +1,8 @@
export * from './columns'
+export * from './dialog-path-floor.js'
export * from './sizes'
export * from './timing'
+export * from './todo-bar-cells.js'
+export * from './todo-bar-reserve.js'
export * as default from '.'
diff --git a/mods/diff/hooks/views/sections/todo-bar-cells/todo-bar-cells.ts b/mods/diff/hooks/limits/todo-bar-cells.ts
similarity index 100%
rename from mods/diff/hooks/views/sections/todo-bar-cells/todo-bar-cells.ts
rename to mods/diff/hooks/limits/todo-bar-cells.ts
diff --git a/mods/diff/hooks/views/sections/todo-bar-reserve/todo-bar-reserve.ts b/mods/diff/hooks/limits/todo-bar-reserve.ts
similarity index 100%
rename from mods/diff/hooks/views/sections/todo-bar-reserve/todo-bar-reserve.ts
rename to mods/diff/hooks/limits/todo-bar-reserve.ts
diff --git a/mods/diff/hooks/views/sections/dialog-file-row/dialog-file-row.tsx b/mods/diff/hooks/views/sections/dialog-file-row/dialog-file-row.tsx
index 71be6778..ea0eefa9 100644
--- a/mods/diff/hooks/views/sections/dialog-file-row/dialog-file-row.tsx
+++ b/mods/diff/hooks/views/sections/dialog-file-row/dialog-file-row.tsx
@@ -3,10 +3,9 @@
/* @jsxFrag Fragment */
import type { RenderElement } from 'claude-code'
+import Limits from '../../../limits'
import type { Kit } from '../../kit'
import Layout from '../../layout'
-import { DIALOG_PATH_FLOOR } from '../dialog-path-floor'
-import { DIALOG_PATH_RESERVE } from '../dialog-path-reserve'
import { diffStat } from '../diff-stat'
import type { FileRowModel } from '../file-row-model'
import { listRow } from '../list-row'
@@ -27,7 +26,12 @@ export function dialogFileRow(
onPress: () => void,
): RenderElement {
const { Text } = kit.ui
- const room = Math.max(DIALOG_PATH_FLOOR, kit.columns - DIALOG_PATH_RESERVE)
+
+ const room = Math.max(
+ Limits.DIALOG_PATH_FLOOR,
+ kit.columns - Limits.DIALOG_PATH_RESERVE,
+ )
+
const mark = row.isSelected ? POINTER : ' '
const name = Layout.truncateStart(Layout.sanitizeName(row.displayPath), room)
diff --git a/mods/diff/hooks/views/sections/dialog-path-floor/index.ts b/mods/diff/hooks/views/sections/dialog-path-floor/index.ts
deleted file mode 100644
index 618af5dc..00000000
--- a/mods/diff/hooks/views/sections/dialog-path-floor/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './dialog-path-floor.js'
-
-export * as default from '.'
diff --git a/mods/diff/hooks/views/sections/dialog-path-reserve/index.ts b/mods/diff/hooks/views/sections/dialog-path-reserve/index.ts
deleted file mode 100644
index 55e2f8ad..00000000
--- a/mods/diff/hooks/views/sections/dialog-path-reserve/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './dialog-path-reserve.js'
-
-export * as default from '.'
diff --git a/mods/diff/hooks/views/sections/file-row/file-row.ts b/mods/diff/hooks/views/sections/file-row/file-row.ts
index 7a9d4ac5..afb792c0 100644
--- a/mods/diff/hooks/views/sections/file-row/file-row.ts
+++ b/mods/diff/hooks/views/sections/file-row/file-row.ts
@@ -1,12 +1,11 @@
import type { RenderElement } from 'claude-code'
+import Limits from '../../../limits'
import type { Kit } from '../../kit'
import Layout from '../../layout'
import { diffStat } from '../diff-stat'
import type { FileRowModel } from '../file-row-model'
import { listRow } from '../list-row'
-import { PATH_FLOOR } from '../path-floor'
-import { STAT_CELLS } from '../stat-cells'
import { statTextOf } from '../stat-text-of'
/**
@@ -29,7 +28,7 @@ export function fileRow(
const label = Layout.padEnd(
Layout.truncateStart(
Layout.sanitizeName(row.displayPath),
- Math.max(kit.columns - STAT_CELLS, PATH_FLOOR),
+ Math.max(kit.columns - Limits.STAT_CELLS, Limits.PATH_FLOOR),
),
kit.columns - statTextOf(row.added, row.removed).length,
)
diff --git a/mods/diff/hooks/views/sections/index.ts b/mods/diff/hooks/views/sections/index.ts
index a40c22de..b4840c7d 100644
--- a/mods/diff/hooks/views/sections/index.ts
+++ b/mods/diff/hooks/views/sections/index.ts
@@ -1,7 +1,5 @@
export * from './ask-key-of'
export * from './dialog-file-row'
-export * from './dialog-path-floor'
-export * from './dialog-path-reserve'
export * from './diff-stat'
export * from './dim-note'
export * from './divider.jsx'
@@ -14,17 +12,13 @@ export * from './legend-row.jsx'
export * from './list-edge-button'
export * from './list-row'
export * from './name-row'
-export * from './path-floor'
export * from './pointer'
export * from './present'
export * from './pressable'
export * from './source-picker.jsx'
-export * from './stat-cells'
export * from './stat-text-of'
export * from './title-row.jsx'
export * from './todo-bar.jsx'
-export * from './todo-bar-cells'
-export * from './todo-bar-reserve'
export * from './toggle-row.jsx'
export * as default from '.'
diff --git a/mods/diff/hooks/views/sections/legend-row.tsx b/mods/diff/hooks/views/sections/legend-row.tsx
index 78881bc2..0bcc7f5f 100644
--- a/mods/diff/hooks/views/sections/legend-row.tsx
+++ b/mods/diff/hooks/views/sections/legend-row.tsx
@@ -3,12 +3,11 @@
/* @jsxFrag Fragment */
import type { RenderElement } from 'claude-code'
+import Limits from '../../limits'
import type Entries from '../entries'
import type { Kit } from '../kit'
import Layout from '../layout'
import { diffStat } from './diff-stat'
-import { PATH_FLOOR } from './path-floor'
-import { STAT_CELLS } from './stat-cells'
/**
* One row of the open pre-session section's legend (PreSessionSection): the
@@ -27,7 +26,7 @@ export function legendRow(kit: Kit, entry: Entries.BodyEntry): RenderElement {
<Text dimColor wrap="truncate-end">
{Layout.truncateStart(
Layout.sanitizeName(entry.displayPath),
- Math.max(kit.columns - STAT_CELLS, PATH_FLOOR),
+ Math.max(kit.columns - Limits.STAT_CELLS, Limits.PATH_FLOOR),
)}
</Text>,
<Box flexGrow={1} />,
diff --git a/mods/diff/hooks/views/sections/path-floor/index.ts b/mods/diff/hooks/views/sections/path-floor/index.ts
deleted file mode 100644
index c5c14fbf..00000000
--- a/mods/diff/hooks/views/sections/path-floor/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './path-floor.js'
-
-export * as default from '.'
diff --git a/mods/diff/hooks/views/sections/stat-cells/index.ts b/mods/diff/hooks/views/sections/stat-cells/index.ts
deleted file mode 100644
index 66c29aea..00000000
--- a/mods/diff/hooks/views/sections/stat-cells/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './stat-cells.js'
-
-export * as default from '.'
diff --git a/mods/diff/hooks/views/sections/todo-bar-cells/index.ts b/mods/diff/hooks/views/sections/todo-bar-cells/index.ts
deleted file mode 100644
index 8570d75b..00000000
--- a/mods/diff/hooks/views/sections/todo-bar-cells/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './todo-bar-cells.js'
-
-export * as default from '.'
diff --git a/mods/diff/hooks/views/sections/todo-bar-reserve/index.ts b/mods/diff/hooks/views/sections/todo-bar-reserve/index.ts
deleted file mode 100644
index e914070d..00000000
--- a/mods/diff/hooks/views/sections/todo-bar-reserve/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './todo-bar-reserve.js'
-
-export * as default from '.'
diff --git a/mods/diff/hooks/views/sections/todo-bar.tsx b/mods/diff/hooks/views/sections/todo-bar.tsx
index c43fc3b3..5faa5d36 100644
--- a/mods/diff/hooks/views/sections/todo-bar.tsx
+++ b/mods/diff/hooks/views/sections/todo-bar.tsx
@@ -3,10 +3,9 @@
/* @jsxFrag Fragment */
import type { RenderElement } from 'claude-code'
+import Limits from '../../limits'
import type PaneState from '../../pane-state'
import type { Kit } from '../kit'
-import { TODO_BAR_CELLS } from './todo-bar-cells'
-import { TODO_BAR_RESERVE } from './todo-bar-reserve'
/**
* The session's todo progress as a bar and `done/total`, drawn only while
@@ -30,7 +29,7 @@ export function todoBar(
const cells = Math.max(
1,
- Math.min(TODO_BAR_CELLS, kit.columns - TODO_BAR_RESERVE),
+ Math.min(Limits.TODO_BAR_CELLS, kit.columns - Limits.TODO_BAR_RESERVE),
)
const filled = Math.round((todos.done / todos.total) * cells)