Skip to content

Commit ac5ba54

Browse files
committed
Cap numbered go-to addresses at nine
Keep every numbered g destination one digit long so the final key selects immediately. Lists expose only their first nine members; the Page map still counts and navigates later locations through its existing controls. Remove decimal-prefix and Enter state. Labels, chips, help, and dispatch now read the same capped list, with browser coverage for a 12-location fixture.
1 parent fff16e6 commit ac5ba54

7 files changed

Lines changed: 119 additions & 195 deletions

File tree

‎skills/leaf/CLAUDE.md‎

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,13 +1311,15 @@ immediately after the target's rendered text block (or the target itself). Addin
13111311
another target action must not add another absolute row, control type, or rail
13121312
measurement.
13131313

1314-
That ordered target collection is also the Page map's location count and the `g m`
1315-
address list. A location's informational marker announces its position in that complete
1316-
collection. Addressing an item opens its marker when it has one; an action-only item
1317-
receives focus on its first available action without performing it. In the compact
1318-
posture, an informational item opens the Page map sheet at that location instead of
1319-
reviving the hidden desktop preview; an action-only item keeps its direct focus arrival
1320-
on the action docked into the page.
1314+
That ordered target collection is the Page map's complete location count and the source
1315+
for the `g m` address list. A location's informational marker announces its position in
1316+
the complete collection. The numbered chord exposes the collection's first nine
1317+
locations; later locations remain in the Page map and ordinary focus order rather than
1318+
making a one-digit chord ambiguous. Addressing an item opens its marker when it has one;
1319+
an action-only item receives focus on its first available action without performing it.
1320+
In the compact posture, an informational item opens the Page map sheet at that location
1321+
instead of reviving the hidden desktop preview; an action-only item keeps its direct
1322+
focus arrival on the action docked into the page.
13211323

13221324
`margin-layout` places, packs, docks, and measures the complete host. Its rail
13231325
claim is the widest stable contribution seen and is monotonic for the document's
@@ -2141,7 +2143,7 @@ region.
21412143

21422144
`g` opens one destination mode. `T`, `A`, and `L` complete a direct trip to
21432145
Threads, Asks, and All leaves. `m`, `h`, and `f` name the page's numbered
2144-
page-map item, hyperlink, and fold lists, and a decimal number names a member. `g g` and
2146+
page-map item, hyperlink, and fold lists, and one digit names a member. `g g` and
21452147
`g G` complete the chord themselves, gliding to the top and bottom of the visible
21462148
scroller. When a thread holds focus, `g k` and `g j`
21472149
place that card at the top or bottom of its list without moving the page. From a
@@ -2164,14 +2166,12 @@ The page-level `g` row promises only the mode; destinations and ranges belong to
21642166
the rows inside it.
21652167

21662168
Arming the mode paints the whole offer. A panel mnemonic completes the travel and
2167-
moves focus inside the panel. Every numbered list contributes chips at once, and
2168-
its mnemonic narrows them to that list. Further digits narrow the chips by numeric
2169-
prefix. A number selects immediately when it is unambiguous. When an exact number
2170-
also prefixes a longer one, Enter selects the exact member and another digit
2171-
continues the address. Escape removes one digit before it backs out to the menu.
2172-
A chip carries the whole address — leader, letter, number, and Enter when it is
2173-
required — so it states which member this is and what remains to type. Every key
2174-
on it is set at the chip's one size, and the split between what is
2169+
moves focus inside the panel. Every numbered list contributes chips for its first
2170+
nine members at once, and its mnemonic narrows them to that list. The following
2171+
digit selects immediately. Escape backs out to the list menu before it closes the
2172+
mode. A chip carries the whole address — leader, letter, and number — so it states
2173+
which member this is and what remains to type. Every key on it is set at the chip's
2174+
one size, and the split between what is
21752175
behind the reader and what is still to press is carried by ground: the spent keys
21762176
sit on the chip's own, the live ones on a lit block (`.lf-spent`, `.lf-lit`). Colour
21772177
alone will not carry it — muted against accent is a difference in hue and barely one
@@ -2193,10 +2193,11 @@ line drops those keys after saying them in the chip that heads it, the reference
21932193
puts them in front of each row so every entry shows the complete chord, and a
21942194
chip on the page sets them back.
21952195

2196-
Numbered addresses are stable within the document. The first addressable members
2197-
do not change identity as the reader scrolls. Chips are painted only for members
2198-
whose `shownRect` is visible, but an off-screen member remains reachable by the
2199-
same address. Chips live in runtime chrome rather than authored markup.
2196+
Numbered addresses are stable within the document and capped at nine per list. The
2197+
first nine members do not change identity as the reader scrolls. Chips are painted
2198+
only for addressable members whose `shownRect` is visible, but an off-screen member
2199+
within that prefix remains reachable by the same address. Chips live in runtime
2200+
chrome rather than authored markup.
22002201

22012202
`NATIVE` describes the platform controls a chord may land on and the immediate
22022203
word for their next press. A summary says whether it will open or close from its

‎skills/leaf/assets/leaf.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -996,9 +996,10 @@ inspectEl.setAttribute("aria-hidden", "true");
996996
// pointer are the spoken copy.
997997
const legendRoot = el("div", "lf-ui lf-legend");
998998
legendRoot.setAttribute("aria-hidden", "true");
999-
// The g chord's numbered document destinations: a chip on every member of the list it has
1000-
// aimed at, drawn here for the same reason the legend is (paintAddresses, its one writer).
1001-
// The eye's copy of what the chord announces, so it says nothing to a screen reader.
999+
// The g chord's numbered document destinations: a chip on each addressable member of the
1000+
// list it has aimed at, drawn here for the same reason the legend is (paintAddresses, its
1001+
// one writer). The eye's copy of what the chord announces, so it says nothing to a screen
1002+
// reader.
10021003
const addressLayer = el("div", "lf-ui lf-addresses");
10031004
addressLayer.setAttribute("aria-hidden", "true");
10041005
// The selection chooser's two faces. Hints and the active search result are paint only;

‎skills/leaf/assets/runtime/chrome-style.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,9 +1278,9 @@ ${MARK_RULES}
12781278
stood (.lf-inspect); the banner takes an accent wash so the mode reads at the top
12791279
edge as well. Nothing here is something to press: pointer-events stands down so a
12801280
click still lands on the item the box outlines. */
1281-
/* The g chord's numbered document destinations: a chip per member of every list it
1282-
offers, narrowed to one list once a letter names it, in a layer of the chrome's own
1283-
so an address can hang on a link set mid-sentence without writing a span into the
1281+
/* The g chord's numbered document destinations: a chip per addressable member of every
1282+
list it offers, narrowed to one list once a letter names it, in a layer of the chrome's
1283+
own so an address can hang on a link set mid-sentence without writing a span into the
12841284
paragraph. Fixed, because authored members can sit in the document or a widget's
12851285
overflow; one layer that follows neither lets a single pass place them from the
12861286
viewport rects it just read, then repaint when anything scrolls under it. Each chip

‎skills/leaf/assets/runtime/keyboard/address.js‎

Lines changed: 22 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function createAddress({
3535
}) {
3636
// ---------- the g chord: the page's destinations ----------
3737
// g names one-off travel. An uppercase mnemonic completes a panel destination (`g T`
38-
// Threads, `g A` Asks, `g L` All leaves), while a numbered list takes a following decimal place
38+
// Threads, `g A` Asks, `g L` All leaves), while a numbered list takes a following digit
3939
// (`g h 3` is the third hyperlink and `g f 2` the second fold). Repeated movement
4040
// through threads and asks belongs to their single-key category walks, t/T and a/A, so
4141
// those categories do not also carry numbered addresses.
@@ -60,8 +60,9 @@ export function createAddress({
6060
// PR is `g h 2` is wrong a moment later; and it would put the key line's own truth on the
6161
// scroll, since a row that goes dead as the page moves is a row the line has to be
6262
// repainted to stop promising — a paint measured at 1.3ms on the corpus, on every scroll
63-
// frame of every page, for one row. Decimal prefixes keep that stable document-order list
64-
// reachable at any length.
63+
// frame of every page, for one row. The numbered route therefore keeps document order
64+
// stable and offers its first nine members; later members remain in the document's own
65+
// navigation rather than making a one-digit address ambiguous.
6566
//
6667
// Above the table rather than beside the other readings below it, because an entry
6768
// holds the function itself and the array literal reads it as the module evaluates.
@@ -161,26 +162,12 @@ export function createAddress({
161162
},
162163
},
163164
];
164-
// A list's addressable members, and the range its label names. The whole list is the
165-
// contract: numeric prefixes extend past nine, so adding a tenth member never removes
166-
// the keyboard route the list promised for its tail.
167-
const addressed = (entry) => entry.list();
165+
// A list's addressable members, and the range its label names. Nine is the whole numbered
166+
// vocabulary: every member has one digit, every digit completes immediately, and every
167+
// consumer below reads this same prefix rather than applying its own cap.
168+
const MAX_NUMBERED_ADDRESSES = 9;
169+
const addressed = (entry) => entry.list().slice(0, MAX_NUMBERED_ADDRESSES);
168170
const range = (n) => (n > 1 ? `1–${n}` : "1");
169-
const addressNumbers = (entry) => addressed(entry).map((_, i) => String(i + 1));
170-
const needsCommit = (entry, n) => Number(n) * 10 <= addressed(entry).length;
171-
const nextAddressKeys = (entry) => {
172-
const numbers = addressNumbers(entry);
173-
const next = [
174-
...new Set(
175-
numbers
176-
.filter((number) => number.startsWith(addressDigits))
177-
.map((number) => number[addressDigits.length])
178-
.filter(Boolean),
179-
),
180-
];
181-
if (addressDigits && numbers.includes(addressDigits)) next.push("Enter");
182-
return next;
183-
};
184171
// How far the chord has come: `g`, and the list's letter once one has named a list. Every
185172
// surface that shows an address asks it — the chip that heads the key line, the ranges
186173
// beside it, the reference's full chords and the dimmed half of a chip on the page — so
@@ -193,8 +180,7 @@ export function createAddress({
193180
// what remains inside the mode. A chip is the one surface with nothing around it to carry
194181
// the leader, and it is drawn only while the window is up, so its two questions — how far
195182
// in, and how much the surroundings already say — have one answer.
196-
const chordKeys = () =>
197-
[labelOf(GOTO), aimedList?.key, addressDigits || null].filter(Boolean);
183+
const chordKeys = () => [labelOf(GOTO), aimedList?.key].filter(Boolean);
198184
// An address as the page wears it: the whole of it, the keys already pressed standing back
199185
// and the ones still to come lit. The whole of it, because a chip is the address — the same
200186
// one every address surface spells while the chord is armed.
@@ -228,17 +214,11 @@ export function createAddress({
228214
const number = String(n);
229215
let spent = labelOf(GOTO);
230216
let live = `${entry.key} ${number}`;
231-
let join = " ";
217+
const join = " ";
232218
if (aimedList) {
233219
spent += ` ${entry.key}`;
234220
live = number;
235221
}
236-
if (addressDigits) {
237-
spent += ` ${addressDigits}`;
238-
live = number.slice(addressDigits.length);
239-
join = "";
240-
}
241-
if (needsCommit(entry, n)) live += " ⏎";
242222
const chip = el("span", "lf-address");
243223
chip.append(el("span", "lf-spent", spent), join, el("span", "lf-lit", live));
244224
return chip;
@@ -256,7 +236,6 @@ export function createAddress({
256236
// other inside the functions that hold both.
257237
let chordArmed = false;
258238
let aimedList = null;
259-
let addressDigits = "";
260239
// Arming, aiming and disarming are one call, because they are one window: naming a list
261240
// re-opens it rather than starting a second.
262241
//
@@ -273,7 +252,6 @@ export function createAddress({
273252
if (on && !chordArmed && claimsEsc(focused())) return;
274253
chordArmed = on;
275254
aimedList = on ? list : null;
276-
addressDigits = "";
277255
// The chips are the eye's copy; the window itself is spoken, or the mode change is
278256
// silent to exactly the reader who can't see them. Off the rows either way, since the
279257
// rows are what the window answers now — the letters at the first stage, the named
@@ -282,11 +260,6 @@ export function createAddress({
282260
if (on) announce(`Go to — ${saying(GO.rows)}`);
283261
paintHere();
284262
}
285-
function setAddressDigits(digits) {
286-
addressDigits = digits;
287-
announce(`Go to — ${saying(GO.rows)}`);
288-
paintHere();
289-
}
290263

291264
// The chips: one per addressable member, drawn in the chrome's layer (addressLayer) and
292265
// placed from the member's own visible box, so a chip cannot claim room the page has
@@ -322,7 +295,6 @@ export function createAddress({
322295
// while panel mnemonics complete their trip without painting numeric chips.
323296
for (const entry of aimedList ? [aimedList] : ADDRESSES) {
324297
for (const [i, member] of addressed(entry).entries()) {
325-
if (addressDigits && !String(i + 1).startsWith(addressDigits)) continue;
326298
const r = startsAt(member, clips);
327299
if (!r || r.bottom <= covered) continue; // nothing to see, nothing to address
328300
const chip = addressChip(entry, i + 1);
@@ -390,7 +362,7 @@ export function createAddress({
390362

391363
// The chord: one scope, a row per panel and addressable list, a row for the page's two
392364
// edges, and the window's own way out. A panel's mnemonic completes its travel. A list
393-
// row holds the whole motion — its letter names the list, and the decimal sequence it
365+
// row holds the whole motion — its letter names the list, and the one digit it
394366
// then binds is the address into it. That is `v`'s shape,
395367
// a chooser whose second key belongs to the scope the first one stood up, and the reason
396368
// it is one row rather than two is that a digits row of its own could not name which list
@@ -476,44 +448,20 @@ export function createAddress({
476448
runFromReference: false,
477449
keys: () => {
478450
if (aimedList !== entry) return [entry.key];
479-
return nextAddressKeys(entry);
451+
return addressed(entry).map((_, i) => String(i + 1));
480452
},
481-
// The range the list actually holds, so the label cannot offer an address no member
482-
// wears. Once a numeric prefix stands, the ordinary spelling of the remaining
483-
// bindings is more useful than restating the full range.
453+
// The range the capped list actually holds, so the label cannot offer an address
454+
// no member wears.
484455
label: () => {
485-
if (addressDigits) {
486-
const next = nextAddressKeys(entry);
487-
const digits = next.filter((key) => key !== "Enter");
488-
const compact =
489-
digits.length > 1 ? `${digits[0]}–${digits.at(-1)}` : digits[0];
490-
return [compact, next.includes("Enter") ? spell("Enter") : null]
491-
.filter(Boolean)
492-
.join(" / ");
493-
}
494456
const members = range(addressed(entry).length);
495457
return aimedList === entry ? members : `${entry.key} ${members}`;
496458
},
497-
does: () =>
498-
addressDigits && addressNumbers(entry).includes(addressDigits)
499-
? `Continue the address, or go to ${entry.word} ${addressDigits} with Enter`
500-
: entry.does,
501-
line: () =>
502-
addressDigits && addressNumbers(entry).includes(addressDigits)
503-
? `continue / choose ${addressDigits}`
504-
: addressDigits
505-
? "continue address"
506-
: entry.word,
507-
when: () => entry.list().length > 0 && (!aimedList || aimedList === entry),
459+
does: entry.does,
460+
line: entry.word,
461+
when: () => addressed(entry).length > 0 && (!aimedList || aimedList === entry),
508462
run: (binding) => {
509463
if (aimedList !== entry) return setChord(true, entry);
510-
const number = binding === "Enter" ? addressDigits : addressDigits + binding;
511-
const numbers = addressNumbers(entry);
512-
const longer = numbers.some(
513-
(candidate) => candidate !== number && candidate.startsWith(number),
514-
);
515-
if (binding !== "Enter" && longer) return setAddressDigits(number);
516-
const member = addressed(entry)[+number - 1];
464+
const member = addressed(entry)[Number(binding) - 1];
517465
setChord(false); // before the travel, so the arrival's own scrolling paints nothing
518466
entry.go(member);
519467
},
@@ -552,21 +500,12 @@ export function createAddress({
552500
// cancelling put them back on the page, pressing `g` again to reach a window that
553501
// had been standing the whole time.
554502
keys: ["Escape"],
555-
does: () =>
556-
addressDigits
557-
? "Remove the last address digit"
558-
: aimedList
559-
? "Back to the lists"
560-
: "Cancel the chord",
561-
line: () =>
562-
addressDigits ? "back one digit" : aimedList ? "back to the lists" : "cancel",
503+
does: () => (aimedList ? "Back to the lists" : "Cancel the chord"),
504+
line: () => (aimedList ? "back to the lists" : "cancel"),
563505
// Re-arming rather than a field of its own: `setChord` is where arming, aiming and
564506
// disarming already live, and re-opening the window with no list named is exactly
565507
// what the second stage backs out to.
566-
run: () => {
567-
if (addressDigits) return setAddressDigits(addressDigits.slice(0, -1));
568-
setChord(Boolean(aimedList));
569-
},
508+
run: () => setChord(Boolean(aimedList)),
570509
},
571510
],
572511
};

‎skills/leaf/references/packages.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ instances use it instead of display prose. If one compact row binds keys with di
148148
meanings, add `routes` with an `id`, `binding`, and action sentence for each meaning. The
149149
key line stays compact, while the complete reference lists and runs each route on its own.
150150
Use `runFromReference: false` only for a parameterized step that cannot be run without a
151-
choice the reference does not have, such as the partly entered digits of an address. An
152-
optional `reach` on a row or scope supplies the short place phrase shown when a command is
153-
not available (for example, `in an open draft editor`).
151+
choice the reference does not have, such as the member digit of a numbered address. An
152+
optional `reach` on a row or scope supplies the short place phrase shown when a command
153+
is not available (for example, `in an open draft editor`).
154154

155155
## External requests and receipts
156156

0 commit comments

Comments
 (0)