The walk hangs off the edge its start isn't on

The breadcrumb snapped flush right whenever the line was fitted, which was
right at rest but wrong the moment ← had scrolled the walk's head back into
view: a line showing its own rounded start chip sat pushed against the far
edge with a lane of blank page in front of it.

Alignment now follows one thing, whether the start is on the line. It fits ⇒
flush left, where a path that begins at its beginning belongs; it doesn't ⇒
the right snap, which is what a cut head looks like, holding the ⋯ against the
edge so it reads as "the line continues off this side" rather than as a gap.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Opus 5 committed 2026-09-05 12:33:27 -04:00
1 parent 6924ff7f45
commit 24e4da9176
2 files changed
+29 -5

No files matched your search

+13 -5
View File
@@ -615,6 +615,14 @@ class WalkScreen(Screen):
against the **right** edge, so the focus and the steps that just led to it are
what a glance lands on.
Which edge the line hangs off follows one thing only: **whether the walk's start
is on it.** A line that shows its first hop — the rounded head chip, us — sits
flush **left**, where a path that begins at its beginning belongs; the right snap
is what a *cut* head looks like, holding the ``⋯`` against the far edge so the
elision reads as "the line continues off this side" rather than as a gap. So it
is not the resting state that decides, but the fit: a scrolled line whose head
has come back into view is left-aligned like any other complete one.
← and → then **scroll it** (JP, 2026-08-09), a hop at a time, off the tail end:
the elided head is a real part of the walk and a long one had no way to be read
at all. A scrolled line grows its own trailing ``⋯`` — the focus is now the part
@@ -628,14 +636,14 @@ class WalkScreen(Screen):
self._trail_width = width
limit = self._trail_max_scroll(width)
self._trail_scroll = max(0, min(self._trail_scroll, limit))
if not limit and not self._trail_scroll:
full = PathLine(hops, separator=_TRAIL_SEP).text()
if full.cell_len <= width:
return full
kept = hops[: len(hops) - self._trail_scroll]
if self._trail_scroll:
kept.append(elision_hop()) # the focus is off to the right
fitted = PathLine(kept, separator=_TRAIL_SEP).ellipsized(width, elide=ELIDE_HEAD)
line = PathLine(kept, separator=_TRAIL_SEP)
full = line.text()
if full.cell_len <= width:
return full # the start is in view: the walk reads from where it set out
fitted = line.ellipsized(width, elide=ELIDE_HEAD)
snapped = Text(" " * max(0, width - fitted.cell_len)) # snap the tail to the edge
snapped.append_text(fitted)
return snapped
+16
View File
@@ -309,6 +309,22 @@ def test_walk_trail_sits_left_until_it_overflows() -> None:
assert screen._trail_text(40).plain == SELF_GLYPH # us, in one cell
def test_walk_trail_scrolled_back_to_its_head_sits_left_again() -> None:
"""Alignment follows the head, not the scroll: a visible start hangs the line left."""
screen, width = _walked_chain(8)
limit = screen._trail_max_scroll(width)
for step in range(1, limit): # every stop short of the head keeps the right snap
screen.handle("left")
cut = _plain([render_to_ansi(screen._trail_text(width), width, no_wrap=True)])
assert cut.startswith(" ") and cut.lstrip().startswith("⋯"), step
screen.handle("left") # the step that brings the walk's start back into view
assert screen._trail_scroll == limit
home = _plain([render_to_ansi(screen._trail_text(width), width, no_wrap=True)])
assert home.startswith(SELF_GLYPH) # flush left, no padding before the head
assert home.rstrip().endswith("⋯") # the elision it does have is on the tail
def test_walk_trail_names_carry_their_node_hues() -> None:
"""Trail names take the per-node key hue (ours the white you-style), the focus bold."""
from meshterm.ui.theme import node_style