Skip to content

Keep the shortcut bar to one row - #1404

Merged
max-sixty merged 7 commits into
mainfrom
one-row-band
Sep 28, 2026
Merged

max-sixty merged 7 commits into
mainfrom
one-row-band

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

The shortcut bar at the page's foot now holds one row, at rest and through a key sequence. After g on a page with threads, Asks and versions, the line needed about 1600px and wrapped to a second row over the page, covering 22px of each pane's foot in a full-height workspace. Now the rows that don't fit leave the line from the end of the register's order, and More and the current way out always stay. The command reference behind More lists what the line dropped. The expanded bar (?) keeps its two-row ceiling under the same trim.

The trim used to run only in the expanded bar, and now runs on every paint:

  • Width. The window resize listener is gone. Chrome layout's existing observer of the bar repaints on any change to its box, including a thread panel narrowing it.
  • Status. A full row puts More at the bar's far end, where the status stands. A standing status (a walk's ordinal, the Go-to filter's "No visible …") now pads the line's end by its width. A transient notice keeps the footprint of what it stands over, as hint placement already does, so for its few seconds it can stand over More. The expanded bar reserves nothing, and a status too wide to leave More and the way out their row gives the room back.

What a user loses: at 1024px the Go-to line drops g V versions and g g / G top / bottom, and at 360px the resting line drops s comment on target. The Threads, Asks and versions controls wear their own Go-to chips while g is armed, so of those, only g g / G is then named nowhere but the reference.

Tests that moved:

  • The Go-to test compared the armed line with the reference at 1280px. It now does that at 2560px, where every destination fits, and asserts one row, the way out and More at 1280px and 420px.
  • The key-projection test now asserts the resting line is one row, not at most two.
  • The transient-notice hint test fixed a link in the bottom-right corner at 1280px, where More now covers it, so it runs at 1920px.

leaf-dev stills gains two states, the Go-to line at 1024px and the resting line at 360px. The TODO item on whether the resting line should wrap below 390px is settled here.

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

🤖 Generated with Claude Code

max-sixty and others added 7 commits September 28, 2026 09:17
The shortcut line, at rest and through a key sequence, now holds one row. Rows
that do not fit leave it from the end of the register's order; More and the
current way out always stay. The shelf keeps its two-row ceiling under the
same trim, which now runs on every paint rather than only in the shelf. A
sequence too long for the window (`g` on a page with threads, Asks and
versions needs about 1600px) no longer wraps over the page's foot, where it
covered 22px of each pane of a held workspace; the rows it drops are in the
command reference.

The trim follows the line's width through a size observer rather than the
window's resize event, since a thread panel opening beside the page narrows
the line after the paint that fitted it.

Tests: the Go-to sequence test compared the armed line with the reference at
1280px; it now compares them at a window that holds every destination, and
asserts one row, the way out and More at 1280 and 420. The TODO item on
whether the resting line should wrap below 390px is settled by this.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	TODO.md
#	dev/leaf_dev/stills.py
#	skills/leaf/assets/runtime/chrome.css
#	skills/leaf/assets/runtime/keyboard/shortcut-bar.js
#	tests/test_chrome_contracts.py
A full row puts More and the way out at the bar's far end, where the status
stands, so a standing status (a walk's ordinal, the Go-to filter's "No
visible ...") now pads the line's end by its width and the trim hides rows
before them. A transient notice keeps the footprint of what it stands over,
as it does for hint placement.

The transient-notice hint test fixed a link in the bottom-right corner at
1280px; the armed line's row now reaches that corner and More stands over
the link, so the test runs at 1920px, where the row ends short of it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…its room

Chrome layout already repaints on any change to the line's box, so the
line's own width observer was a second route to the same repaint; it goes.
The expanded bar reserves no room for the status, whose row is only the
lower one, and a status too wide to leave More and the way out their row
gives the room back and stands over them, so the line stays one row at
320px with a Go-to filter's status standing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 5604929 into main Sep 28, 2026
5 checks passed
@max-sixty
max-sixty deleted the one-row-band branch September 28, 2026 18:12
max-sixty added a commit that referenced this pull request Sep 28, 2026
… and drawings to what they stand beside (#1406)

Document scrolling on a page with comments stuttered. Two things caused
it. Leaf's scroll path wrote to the DOM on every scroll event, and while
a CSS highlight holds a range, Chrome repaints the whole document for
any write, the same value included. And the thread card and the response
bar were `position: fixed` boxes that script re-placed on every scroll,
so they trailed the compositor-scrolled text by a frame. After this
change a scroll writes nothing to the DOM unless something actually
moved, and the floating card, response bar and drawings are anchored to
what they stand beside, so the browser carries them with the page.

## Measurements

Headless Chrome at 1440×900, 80 synthetic wheel steps of 10px. The
latency is Chrome's median `FIRST_GESTURE_SCROLL_UPDATE` from the trace.
What a trackpad feels is inferred from these numbers, not measured.

| Case (`review-a-plan` unless named) | Latency `main` → this branch |
Full-document paints `main` → this branch |
|---|---|---|
| No card open | 13.9 → 11.0 ms | 82 → 2 |
| Thread card open | 47.5 → 14.1 ms | 161 → 6 |
| Response bar up over a selection | 47.5 → 13.8 ms | 160 → 4 |
| `undo-reach` playground, focus in its Ask | 13.6 → 14.0 ms | 79 → 4
(frames with a DOM write 160/220 → 2/220) |

A plain HTML page, outside Leaf, shows the Chrome behaviour: one range
highlight plus one `setAttribute` per scroll event gives 80 paints and
11 → 27 ms. Without the highlight it gives 1 paint.

## What changes

**The scroll path writes only what changed.** `widget-elements.js` now
states the rule and names `classList.toggle(name, force)` as the way to
write a class. `add` and `remove` rewrite the attribute even when the
class set doesn't change. Brought under the rule:

- `clearAim`, the trace, and visual marks (`target-paint.js`)
- the shortcut bar's `hidden` and `data-lf-expanded`
- `data-lf-thread-placement` and `data-lf-placement`
- the Ask ring
- Ask binding badges: previously torn down and re-worn on every pass. A
badge whose control is off screen is no longer worn only to be measured
away.

**Floating surfaces stand in the plane a scroll carries them with.**
`floating.js` gains `position()` and `stand()`. The box stays `position:
fixed`. In the `page` plane it is anchored with CSS anchor positioning,
as the margin's rows already are, to the element it stands beside, and
its spot is written as insets from that anchor. The browser then carries
it through every scroll that moves the anchor, and a placement after
that scroll finds the same insets and writes nothing. In the `window`
plane it is placed in pixels, as before.

- The card reads its plane from `thread-card-geometry.js`, which now
returns `plane`. It is `window` while the boundary's own edge holds the
card in, and `page` otherwise. The card anchors to its cluster.
- The response bar reads its plane from its shift limiter: `window` when
the viewport, rather than the passage, holds it. The bar anchors to its
passage's block.
- Because the box stays fixed, a scroll into view or a focus inside it
still never scrolls the page.
- A box held at a reading region's edge counts as the page's, since the
page carries the region.
- A box under a transformed ancestor, whose containing block is not the
viewport, stays in the `window` plane.
- An anchor lost between placements stands the box off screen, as the
rows fall back, until the next placement.
- Anchor naming moves from `margin-layout.js` to `anchor-names.js`, so
rows and floats share one name per element.

**The card no longer clips itself to the window.** Its per-scroll
`clip-path` is gone.

- The card moves down the z-index ladder to 8920, under the banner and
the bottom bar, so it passes under them the way the text does, blurred
behind the veil rather than cut at its edge.
- The thread transition moves to 8910 to stay under the card.
- A reading region still clips the card.
- A scroll leaves the card's height cap as it is. A card takes a new cap
only when its contents change (a turn arrives, a draft grows), or when
the new cap would cut it.

**Paint in the document plane is not clipped to the window.** Target
paint uses the new `pagePlaneRect`. The page's own clipping boxes and a
stuck root header still cut it; the window no longer does, because that
cut moved with every scroll.

**Drawing marks are anchored too.** Each mark is fixed and anchored to
what it was drawn on (or to `main` for a whole-page drawing). A scroll
no longer rebuilds every mark's SVG, and strokes still stay out of the
document's scrollable overflow.

**Ask binding chips stand in the document plane.** The chips are kept
across passes, and a chip with no room is hidden rather than removed.

## Tests

- `test_a_scroll_that_carries_the_card_writes_nothing` and
`test_a_scroll_that_carries_the_response_bar_writes_nothing` observe the
DOM through a scroll and assert no writes. Both fail on the base, which
has aim, Ask, placement and badge writes.
- The geometry tests now assert `plane` through leaving, returning, an
unseen cluster, and the foot.
- `test_a_drawing_is_sent_and_replayed_as_an_ordinary_comment` now
asserts that a scroll keeps the mark's node; it fails on `main`.
- `test_ask_binding_badges_do_not_cover_their_key_line` now reads only
visible chips, since a chip with no room is hidden rather than removed.
- `uv run pytest tests` and `npm run test:runtime` pass. The nightly
selection over the widgets, margin, navigation, anchors, aim, options,
threads, drafts, controls, drawing and chrome-contract files passes
except four tests that fail identically on `main` after #1404:
`test_ask_action_binding_badges_use_the_available_card_action_seats`,
`test_a_growing_comment_is_independent_of_page_controls`, and two in
`test_render_drafts.py`.
- `leaf-dev stills` against `main` shows no visible change at rest. It
records sub-pixel differences only (at most 18/255 on one channel), in
the card's shadow under the bottom bar and the composer's antialiasing.

## Left as they are

- A card whose target sits in a scrolling pane still rewrites its clip
at the pane's edge on each scroll of that pane.
- While a scroll leaves the card under a larger cap than the room,
growth can stand past the boundary for one frame until the next
placement.
- Crossing between the planes, where the boundary starts or stops
holding a box in, is decided on the main thread, so that one frame can
overshoot or lag. A `position: sticky` band would make it exact, at the
cost of recasting the card geometry as sticky insets.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)
max-sixty pushed a commit that referenced this pull request Sep 28, 2026
)

The [failed nightly
run](https://github.com/max-sixty/leaf/actions/runs/36463573645) reports
two draft tests expecting “your draft” to be visible in the Go-to
shortcut bar. Since #1404 keeps that bar to one row, a live destination
can remain in the command register while its hint is trimmed. Both tests
reproduce that case locally. They now check whether the draft command is
registered when a draft exists, then still press `g D` and verify that
it reopens the saved text or image. The first test also checks that the
command is absent before a draft exists.

Verification: the two tests failed before this edit and passed after it;
both passed 18 concurrent copies each, and the full
`tests/test_render_drafts.py` file passed (83 tests). The pull request
CI will run the broader gate.

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