Skip to content

Make go-to binding hints contextual - #421

Merged
max-sixty merged 3 commits into
mainfrom
codex/binding-hints
Sep 7, 2026
Merged

max-sixty merged 3 commits into
mainfrom
codex/binding-hints

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The banner's named go-to shortcuts were always visible even though generated target hints appear only while g is armed. This makes named destinations use the same transient overlay vocabulary, centers banner hints below their controls, and keeps multi-step progress tied to the exact accepted prefix.

The keyboard reference now lists target filters as individual commands and ranks literal binding-prefix matches first, including case-sensitive g t versus g T. The temporary character-shortcut preference is removed; the binding boundary retains a TODO for a future reader/agent configuration.

The navigation and margin browser files cover responsive placement, collisions, progressive key state, reference search, and preference removal.

This was written by Codex on behalf of max-sixty

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new key-line assertion in test_generated_hints_branch_after_the_single_letter_alphabet pins the Mac spelling of Shift+Tab, so it fails everywhere else — including CI's Linux runner. spell() reads MAC = /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent) and renders Shift: MAC ? "⇧" : "Shift", so the browser produces ⇥ / Shift+⇥ there and the comparison against ⇥ / ⇧⇥ never holds. Reproduced on Linux:

E         At index 1 diff: ['⇥ / Shift+⇥', 'neutral'] != ['⇥ / ⇧⇥', 'neutral']
tests/test_render_navigation.py:3691: AssertionError

The rest of the file already handles this with an alternation (re.search(r"(⌘⏎|Ctrl\+⏎) / 1\nSave / Cancel", …)), and the face spelling isn't what this assertion is for — the progressStates change it proves is that the untaken Tab branch stays neutral. The inline suggestion keeps the state check exact and loosens only the glyph; I ran it on Linux and the case passes.

Everything else here reads clean. The progressStates rewrite from a press count to a per-step match is the right shape for branching routes, the two-pass spreadHints leaves the existing (non-belowTarget) callers byte-identical, and the removal of the character-shortcut preference is complete — no data-lf-chord, lf-spent/lf-lit, or lf-character-shortcuts reader remains anywhere in the tree.

Comment thread tests/test_render_navigation.py Resolved
@max-sixty
max-sixty merged commit 915e665 into main Sep 7, 2026
7 checks passed
@max-sixty
max-sixty deleted the codex/binding-hints branch September 7, 2026 23:00
max-sixty pushed a commit that referenced this pull request Sep 8, 2026
`tests/test_render_anchors.py::test_one_key_keeps_one_keyboard_face_across_the_page`
reads the geometry an item hint claims and compares it with the address
chip and the chord's step keys. #421 moved that geometry: `hintChip` now
spells a hint's whole route as a `keySequence`, so the chip is the
layer's positioned wrapper and the key face belongs to the `kbd` inside
it. The same commit generalized the wrapper's reset — `min-width: 0;
height: auto; padding: 0; border: 0` moved from `.lf-goto-targets >
.lf-chord-address` to every `.lf-targets > .lf-target-hint` — so the
test's read of the chip returned a box with no width floor, no padding,
and no border, against the address chip's `19px`/`0 4px`/`1px solid`.

The test's claim still holds; only its address for the face was stale.
It now reads `.lf-target-hint .lf-key-sequence > kbd:last-child`, which
is where the chord chips a dozen lines above are already read (`{CHIPS}
kbd:last-child`), and it names the step still to be pressed so a hint
that has already spent a letter compares the same face. Nothing in the
runtime changes: the hints render correctly, and `.lf-key-sequence >
kbd` inside the chrome scope gives them the shared key box.

This is #421's own change reaching a nightly module it did not touch. CI
runs nightly cases only in the modules a pull request touches, so
`test_render_anchors.py` first ran under `--run-nightly` after main
moved, in [run
34168568905](https://github.com/max-sixty/leaf/actions/runs/34168568905).

Verified locally: the case fails at the merge base and passes with this
change (`uv run pytest
tests/test_render_anchors.py::test_one_key_keeps_one_keyboard_face_across_the_page
-q -n0`), deterministically in under three seconds each way. `pre-commit
run --files tests/test_render_anchors.py` is clean.

<details><summary>The failing assertion</summary>

```
E       AssertionError: assert {'min-width':...der-box', ...} == {'min-width':...der-box', ...}
E         Differing items:
E         {'min-width': '0px'} != {'min-width': '19px'}
E         {'border-top-width': '0px'} != {'border-top-width': '1px'}
E         {'border-top-style': 'none'} != {'border-top-style': 'solid'}
E         {'padding': '0px'} != {'padding': '0px 4px'}
```

</details>

Co-authored-by: leaf-agent <[email protected]>
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