diff: an attempt to open gives way once the terminal loses room

The room only fed the decision to open: an attempt whose read found the
terminal narrowed went on reading for each edit or command that landed
during a read, with no room to open anything. It now ends there, and the
next edit with room starts an attempt of its own.

The README's `git status` sentence says where that read now happens: at
the first fetch, the one an edit decides on included.
This commit is contained in:
Claude
2026-09-18 23:31:59 +00:00
parent 3dbda69aaf
commit d7f15cd97b
3 changed files with 43 additions and 3 deletions
+2 -2
View File
@@ -58,8 +58,8 @@ forgets it); and the working tree is read only by a fetch for a pane that
is open, after an edit that landed or a shell command that ran, or by the
fetch each edit inside the repository, with room for a pane, makes until
one lists a file and the pane opens on it. The one read the built-in has
no counterpart for is a `git status` at a pane's first fetch, which stands
in for the change time the built-in dates a moved file by.
no counterpart for is a `git status` at the first of those fetches, which
stands in for the change time the built-in dates a moved file by.
`hooks/register.ts` is the module; everything under `hooks/` is its parts.
+3 -1
View File
@@ -514,7 +514,9 @@ export function register(on: On) {
}
}
if (seen === landed || isOvertaken) {
const hasLostRoom = !isListing && !hasRoomFor(floor)
if (seen === landed || isOvertaken || hasLostRoom) {
return
}
+38
View File
@@ -875,6 +875,44 @@ describe('register', () => {
expect(world.opened, 'the room it read for is gone').toEqual([])
})
test('nor does a command landing in that read have it read again, the next edit with room does', async ($, on) => {
const world = Fixtures.inSlowRepository(on)
const edit = () =>
$.tool.call({
tool: 'Edit',
file_path: '/work/app.ts',
old_string: '1',
new_string: '2',
})
on('tool.call', () => ({ result: 'done' }))
await $.session.start(Fixtures.SESSION)
await $.ui.render(Fixtures.HINT)
await edit()
await world.clock.settle()
await $.ui.render(Fixtures.hintAt(Limits.AUTO_OPEN_MIN_COLUMNS - 1))
await $.tool.call({ tool: 'Bash', command: 'make' })
await world.clock.advance(Fixtures.SETTLE_MS)
expect(
world.reads,
'the attempt gave way with the room; it read for nothing more',
).toEqual([0])
expect(world.opened).toEqual([])
await $.ui.render(Fixtures.HINT)
await edit()
await world.clock.advance(Fixtures.SETTLE_MS)
expect(
world.opened.map(pane => pane.id),
'wide again, the next edit starts an attempt of its own',
).toEqual(['diff'])
})
test("only the main loop's edit opens the pane", async ($, on) => {
const world = Fixtures.inRepository(on)