Skip to content

Find a command's keys through the command that opens its scope - #6827

Merged
max-sixty merged 2 commits into
mainfrom
changes-into-versions
Nov 23, 2026
Merged

max-sixty merged 2 commits into
mainfrom
changes-into-versions

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A key shown for a press is now found through the command that opens the scope holding it. A command row may declare opens, the scope its press enters, and pressNow (control-keys.js) answers a command's own binding where a key reaches it, else the keys of a command that would open its scope, then its own binding. So g V l for Open latest comes through Go-to's g and then Versions' g V, and the lookup's Go-to case, Versions' throughVersions helper with its two key constants, and the Scope field sequencePrefix go. Each press at the panel field's end names its command (NoticePress.command) and takes its keys from it, and its run unless it brings its own; Open latest becomes such a press.

What the user sees. Open latest says l while Versions has focus, where it showed no keys though l worked. While Versions stands, Go-to announces Shift+V first, as it does the door to any other standing panel surface, and names it "close Versions"; closed, its name reads "Versions", capitalized as the other doors' are. Show changes still shows no keys while Versions stands, since there v compares whichever version the user is on.

Where to look. The design Max picked had each row name its door; the change has the door command name the scope it opens instead, because Versions' rows live in one element declaration on the panel, which the lookup can't list without a scan that grows with the page. Compare's when answers before Versions opens from the version Versions opens at (offeredVersion), since its control is drawn only once Versions opens. pressReading moved from notifications.js into floating-panel.js, its only reader, because notifications.js can't import the key lookup without a cycle through dispatch.js.

Max asked for this as a follow-up to #6788 and picked the design on the handoff page; an independent review's findings are folded in. Tests: a new browser test covers Open latest's keys from the page and inside Versions; the return notice, the ways back from a settlement (the notice's Undo among them), a Resolve's notice standing for that Resolve alone, Open latest's press, the command reference's Go-to destinations, pnpm run check:browser and pnpm run test:runtime pass.

This was written by Claude Code on behalf of max-sixty

Show changes and Open latest said `g V v` and `g V l` through a helper in
version.js (`throughVersions`), and the key lookup (`pressNow`,
control-keys.js) reached Go-to's destinations through a case of its own that
read the Go-to scope's `sequencePrefix`. Both are one relation: a key reached
through the command whose press opens the scope it stands in. Five presses at
the panel field's end also named their command twice, once for their keys
and once for their run, and Open latest built its press by hand.

A command row of the page's scopes may now declare `opens`, the scope its
press enters, whose `at` says whether that scope stands already. `pressNow`
answers a command's own binding where a key reaches it, else the keys of a
command that would open its scope, found the same way, then its own binding,
so `g V l` comes through Go-to's `g` and then Versions' `g V`. `commandSteps`
and the command reference take a scope's prefix from the command that opens
it, so the Scope field `sequencePrefix` goes. `g` opens Go-to's scope, `g V`
Versions' keys, and each of the panel's doors its view's keys. Go-to's
`DOOR_STANDS` map, which said whose surface stands, now reads those scopes.

A field press names its command (`NoticePress.command`) and takes its keys
from it and, unless it brings its own, its run. Open latest becomes such a
press, which retires the field's "latest" sentinel. Show changes names
Versions' Compare only while Versions is closed, since there `v` compares
whichever version the user is on. `pressReading` moved into
floating-panel.js, its only reader: notifications.js can't import the key
lookup, which dispatch.js, an importer of notifications.js, sits under.

What the user sees: Open latest says `l` while Versions has focus, where it
showed no keys though `l` worked. While Versions stands, Go-to announces
`Shift+V` first, as it does the door to any other panel surface standing, and
names it "close Versions", which its press does; closed, it reads "Versions"
where it read "versions", as the other doors capitalize their surface. Compare's `v` says whether it applies before Versions opens from the version
Versions opens at (`offeredVersion`), since its control is drawn only once
Versions opens.

Go-to's unused `formatGoToAddress` goes.

Max picked this design on the handoff page for #6788's follow-ups, after
asking what kept Versions' keys from being part of the panel's own. The design
he picked had each row name its door; here the door names the scope it opens,
since Versions' rows live in one element declaration on the panel, which the
lookup can't list without a scan that grows with the page. An independent
review's findings are folded in.

Tests: test_open_latest_says_the_keys_that_reach_it_from_where_the_user_is is
new and fails on the base, where Versions open showed no keys for Open latest.
The return notice's `g V v`, the touchscreen notice, the ways back from a
settlement (the notice's Undo among them), a Resolve's notice standing for
that Resolve alone, Open latest's press and poll, the command reference's Go-to destinations and Versions row,
`pnpm run check:browser` and `pnpm run test:runtime` pass.
@max-sixty
max-sixty merged commit d9b9843 into main Nov 23, 2026
5 of 6 checks passed
@max-sixty
max-sixty deleted the changes-into-versions branch November 23, 2026 04:37
max-sixty added a commit that referenced this pull request Nov 23, 2026
A notice's Undo now shows only while ⌘Z would take the gesture the
notice reports. Before, a Resolve that left no thread open said "All
threads resolved · Undo ⌘Z", and a pick made while that notice stood
left it unchanged: ⌘Z then took back the pick, while a click on the
notice's Undo took back the Resolve. Now the notice keeps its words and
drops the press once another gesture is the newest.

**Where to look.** `offerUndo` (undo.js) names ⌘Z's command only while
⌘Z's next target is its gesture, and no command otherwise; the field
draws no press without keys, as it already does for Show changes while
Versions stands. The press's own `run`, which took back its gesture by
attempt, goes, since the press now only shows when ⌘Z's own press would
take the same gesture. ⌘Z twice, or Reopen in Threads, still takes the
Resolve back.

Max picked this on the handoff page for #6827's follow-ups, over keeping
the click. Tests:
`test_a_resolve_s_notice_stands_for_that_resolve_alone` now holds that
the notice offers no Undo once another tab's Reopen is the newest
gesture (it held the reverse); it, the other Resolve-notice test, every
way back from a settlement, `pnpm run check:browser` and `pnpm run
test:runtime` pass.

> _This was written by Claude Code on behalf of max-sixty_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants