A blurred chip seam is the thin chevron in ink, not a wedge cut out of the route
Where two consecutive chips share a fill or sit under SEAM_HUE_GAP apart, the seam was the solid point drawn bare, so the page cut a wedge out of the ribbon: a run of near hues read as dashes, and on a light terminal the wedge was a hole. It is now the thin chevron (U+E0B1, core powerline set) in the chip's ink on the fill ahead, powerline's own mark for a join inside one colour. The ribbon runs on unbroken, the join is a line drawn on it, and it wears no fill of its own so it can't be taken for a chip; on a faded leg it takes the dim ink and recedes with what it joins. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
2404c5286c
commit
1da1c9db0d
3 files changed
+87
-63
No files matched your search
@@ -311,10 +311,12 @@ as a grouped list does. Filling a page in is editing its `.md`; no Python follow
|
||||
that differ from row to row. As a chip it is the map's yellow star on neutral dark
|
||||
grey, padded like every other chip.
|
||||
- Chip seams are **one** interlocked chevron (previous fill on next). Two chips of the
|
||||
same fill are the exception the interlock can't draw: the point drops its background so
|
||||
the page cuts the wedge — and so do two hues too close to tell apart, first key bytes
|
||||
under `pathline.SEAM_HUE_GAP` (0x10) apart on the wheel, circularly; the greys blend
|
||||
only with their exact selves. An elision breaks the ribbon rather than joining it — bare `⋯`
|
||||
same fill are the exception the interlock can't draw — and so are two hues too close to
|
||||
tell apart, first key bytes under `pathline.SEAM_HUE_GAP` (0x10) apart on the wheel,
|
||||
circularly; the greys blend only with their exact selves. There the seam is the **thin**
|
||||
chevron (`POWERLINE_THIN`) in the chip's ink on the shared fill, so the ribbon runs on
|
||||
unbroken and the join is a line drawn on it, never a wedge of page cut out of the
|
||||
route. An elision breaks the ribbon rather than joining it — bare `⋯`
|
||||
on the page between a closing point and the next chip's notch, no fill, no padding.
|
||||
- The ribbon's **outer ends**: the chevron means *the route continues*, so an end that is
|
||||
the route's own never wears one. It ends **square** — nothing appended, the last chip's
|
||||
|
||||
+34
-20
@@ -17,8 +17,9 @@ drawn*, so every surface the survey found can eventually route through it:
|
||||
``★`` on a neutral dark grey, a faded hop dark slate, a keyless hop grey. Two chips that
|
||||
land on the *same* fill — a mirrored return leg, a stretch of keyless greys — or on two
|
||||
hues too close to tell apart (first key bytes under :data:`SEAM_HUE_GAP` apart on the
|
||||
wheel) take the one exception the interlock can't draw, dropping the background so the
|
||||
page cuts the wedge (:meth:`PathLine._seam`). Hops elided out of the middle break the
|
||||
wheel) take the one exception the interlock can't draw: the seam is the *thin* chevron
|
||||
instead, ink on the shared fill, so the ribbon runs on unbroken and the join is a line
|
||||
drawn on it (:meth:`PathLine._seam`). Hops elided out of the middle break the
|
||||
ribbon instead of joining it: the mark sits bare on the page between a closing point and
|
||||
the next chip's notch (:func:`elision_hop`), because a filled ``⋯`` chip would read as a
|
||||
node by that name. A chip caught by a *cut* — a lane that ran out, a line scrolled past
|
||||
@@ -91,13 +92,19 @@ from .marks import SELF_MARK
|
||||
from .termfont import powerline_enabled, powerline_full
|
||||
from .theme import active_theme, node_style
|
||||
|
||||
#: The powerline solid right-pointing triangle (U+E0B0) — the only glyph the widget
|
||||
#: draws, seam and closing edge alike, deliberately from the *core* set so every
|
||||
#: recommended font qualifies (the rounded caps at U+E0B4+ exist only in full Nerd
|
||||
#: Font patches). A path only ever flows one way, so the point only ever faces right;
|
||||
#: what changes is whether it lands on a field (a seam) or on the page (an edge).
|
||||
#: The powerline solid right-pointing triangle (U+E0B0) — the glyph the widget draws
|
||||
#: at every seam and closing edge, deliberately from the *core* set so every recommended
|
||||
#: font qualifies (the rounded caps at U+E0B4+ exist only in full Nerd Font patches). A
|
||||
#: path only ever flows one way, so the point only ever faces right; what changes is
|
||||
#: whether it lands on a field (a seam) or on the page (an edge).
|
||||
POWERLINE_SEP = "\ue0b0"
|
||||
|
||||
#: The thin right-pointing chevron (U+E0B1), the solid point's outline sibling in the
|
||||
#: same core set — powerline's own mark for a join *inside* one colour. It draws the seam
|
||||
#: between two chips whose fills the eye can't tell apart (:meth:`PathLine._seam`): a
|
||||
#: line of ink on the fill they share, where a solid point would have vanished into it.
|
||||
POWERLINE_THIN = "\ue0b1"
|
||||
|
||||
#: The rounded caps (U+E0B6 opening, U+E0B4 closing) that finish a path's two outer
|
||||
#: ends as a lozenge. These live in the *extended* block, which only a full Nerd Font
|
||||
#: patch carries (:func:`~meshterm.ui.termfont.powerline_full`) — a terminal with just
|
||||
@@ -252,8 +259,8 @@ def _style_hex(style: str) -> str | None:
|
||||
|
||||
|
||||
#: How far apart two chip hues must sit on the 256-step wheel for a seam to interlock
|
||||
#: them: closer than this and the point is drawn on the page instead, as it is for two
|
||||
#: fills that are identical (:meth:`PathLine._seam`). The wheel *is* the node's first key
|
||||
#: them: closer than this and the seam is the thin chevron in ink instead, as it is for
|
||||
#: two fills that are identical (:meth:`PathLine._seam`). The wheel *is* the node's first key
|
||||
#: byte (:func:`~meshterm.ui.theme.node_style` maps ``0x00``–``0xff`` straight round it),
|
||||
#: so this is a difference in first bytes — under ``0x10`` and two neighbours are one
|
||||
#: ribbon to the eye, a chevron of one shade of green laid on the next (JP, 2026-09-15).
|
||||
@@ -983,7 +990,7 @@ class PathLine:
|
||||
elif hop.gap:
|
||||
text.append(POWERLINE_SEP, style=fills[i - 1]) # …and stops here
|
||||
else:
|
||||
text.append_text(self._seam(fills[i - 1], fills[i]))
|
||||
text.append_text(self._seam(fills[i - 1], fills[i], hop))
|
||||
if hop.gap:
|
||||
text.append(hop.label, style="faint" if hop.dim else "muted")
|
||||
else:
|
||||
@@ -997,7 +1004,7 @@ class PathLine:
|
||||
return text
|
||||
|
||||
@staticmethod
|
||||
def _seam(before: str, after: str) -> Text:
|
||||
def _seam(before: str, after: str, ahead: PathHop) -> Text:
|
||||
"""The one cell between two chips: the previous fill's point, laid on the next.
|
||||
|
||||
The classic interlock — foreground the chip behind, background the chip ahead —
|
||||
@@ -1010,25 +1017,32 @@ class PathLine:
|
||||
Two fills that *do* land the same are the exception the interlock cannot draw —
|
||||
a chevron in its own background is no chevron — and they are not always bad luck:
|
||||
a mirrored return leg is a run of identically faded hops by construction, and so
|
||||
is a stretch of keyless greys. There the point drops its background and the page
|
||||
shows through the wedge instead, which is the one thing that still separates two
|
||||
blocks of one colour. One cell either way.
|
||||
is a stretch of keyless greys. *Nearly* the same is the same exception: two hues a
|
||||
few steps apart on the wheel draw a chevron the eye can't find either, one shade of
|
||||
green on the next, so two first bytes under :data:`SEAM_HUE_GAP` apart count too
|
||||
(:func:`_fills_blur`, JP, 2026-09-15). The greys are exempt: a keyless hop beside a
|
||||
dimmed one shows two distinct fills and keeps its interlock.
|
||||
|
||||
*Nearly* the same is the same exception: two hues a few steps apart on the wheel
|
||||
draw a chevron the eye can't find either — one shade of green on the next — so
|
||||
two first bytes under :data:`SEAM_HUE_GAP` apart fall back to the page as well
|
||||
(:func:`_fills_blur`, JP, 2026-09-15). The greys are exempt: a keyless hop beside
|
||||
a dimmed one shows two distinct fills and keeps its interlock.
|
||||
There the seam is the **thin** chevron, :data:`POWERLINE_THIN`, in the chip's ink
|
||||
on the fill ahead — powerline's own mark for a join inside one colour (JP,
|
||||
2026-09-16). The ribbon runs on unbroken and the join is a line drawn on it,
|
||||
where the solid point drawn bare used to cut a wedge of page out of the route: a
|
||||
run of near hues read as dashes, and on a light terminal the wedge was a hole. It
|
||||
wears no fill of its own, so it can't be mistaken for a chip, and the ink is the
|
||||
one the chip ahead uses for its label — the dim ink on a faded leg — so the mark
|
||||
recedes with what it joins. One cell either way.
|
||||
|
||||
Args:
|
||||
before: The fill the point is drawn in (the previous chip's).
|
||||
after: The fill it is laid on (the next chip's).
|
||||
ahead: The hop the seam leads into — its ink is the thin chevron's.
|
||||
|
||||
Returns:
|
||||
The seam's single styled cell.
|
||||
"""
|
||||
if _fills_blur(before, after):
|
||||
return Text(POWERLINE_SEP, style=before) # fg only — the page cuts the wedge
|
||||
ink = _DIM_FG if ahead.dim else _CHIP_FG
|
||||
return Text(POWERLINE_THIN, style=f"{ink} on {after}")
|
||||
return Text(POWERLINE_SEP, style=f"{before} on {after}")
|
||||
|
||||
@staticmethod
|
||||
|
||||
+47
-39
@@ -15,6 +15,9 @@ import pytest
|
||||
|
||||
import meshterm.ui.pathline as pathline
|
||||
from meshterm.ui.pathline import (
|
||||
_CHIP_FG,
|
||||
_DIM_BG,
|
||||
_DIM_FG,
|
||||
_SELF_INK,
|
||||
_YOU_BG,
|
||||
CRACK_HEAD,
|
||||
@@ -26,6 +29,7 @@ from meshterm.ui.pathline import (
|
||||
POWERLINE_ROUND_CLOSE,
|
||||
POWERLINE_ROUND_OPEN,
|
||||
POWERLINE_SEP,
|
||||
POWERLINE_THIN,
|
||||
SELF_GLYPH,
|
||||
WRAP_OFFSET,
|
||||
PathHop,
|
||||
@@ -147,7 +151,7 @@ def test_auto_mode_follows_the_terminal_verdict(monkeypatch: pytest.MonkeyPatch)
|
||||
"""``auto`` renders chips exactly when the terminal can draw them."""
|
||||
hops = [PathHop("a"), PathHop("b")]
|
||||
monkeypatch.setattr(pathline, "powerline_enabled", lambda: True)
|
||||
assert POWERLINE_SEP in PathLine(hops).text().plain
|
||||
assert POWERLINE_THIN in PathLine(hops).text().plain # two keyless greys: the thin seam
|
||||
monkeypatch.setattr(pathline, "powerline_enabled", lambda: False)
|
||||
assert PathLine(hops).text().plain == "a → b"
|
||||
|
||||
@@ -639,39 +643,44 @@ def test_a_wrapped_route_middle_pays_for_both_its_chevrons() -> None:
|
||||
assert not folded[-1].plain.strip().startswith("→") # a continuation opens on its hop
|
||||
|
||||
|
||||
def test_a_seam_between_two_of_one_colour_falls_back_to_the_page() -> None:
|
||||
"""Where two chips land on the same fill, the seam falls back to the bare page.
|
||||
def _seams(*hops: PathHop) -> list[tuple[str, str]]:
|
||||
"""Every seam cell of a chip line as ``(glyph, style)``, in order."""
|
||||
text = PathLine(list(hops), mode="powerline").text()
|
||||
return [
|
||||
(text.plain[s.start], str(s.style))
|
||||
for s in text.spans
|
||||
if text.plain[s.start] in (POWERLINE_SEP, POWERLINE_THIN)
|
||||
]
|
||||
|
||||
The interlock can't draw a chevron in its own background, so the point drops its
|
||||
background and the page cuts the wedge instead.
|
||||
|
||||
def test_a_seam_between_two_of_one_colour_is_the_thin_chevron_in_ink() -> None:
|
||||
"""Where two chips land on the same fill, the seam is the thin chevron in ink.
|
||||
|
||||
The interlock can't draw a solid point in its own background, so the join is drawn
|
||||
*on* the shared fill instead — powerline's own mark for a join inside one colour —
|
||||
and the ribbon runs on unbroken. It wears the chip's ink, the dim ink on a faded leg,
|
||||
and no fill of its own, so it can never be taken for a chip.
|
||||
|
||||
Not a rare accident, either: a mirrored return leg is a run of identically faded hops
|
||||
by construction, and a stretch of keyless hops shares one grey. Either way it stays a
|
||||
single cell — the fallback trades the blend for the separation, not for width.
|
||||
single cell — the fallback trades the interlock for the outline, not for width.
|
||||
"""
|
||||
hue = _style_hex(node_style("aa"))
|
||||
same = PathLine([PathHop("A", key="aa"), PathHop("B", key="aa")], mode="powerline")
|
||||
text = same.text()
|
||||
seam = next(s for s in text.spans if text.plain[s.start] == POWERLINE_SEP)
|
||||
assert str(seam.style) == hue # foreground only: the page shows through the wedge
|
||||
|
||||
apart = PathLine([PathHop("A", key="aa"), PathHop("B", key="77")], mode="powerline")
|
||||
text = apart.text()
|
||||
seams = [str(s.style) for s in text.spans if text.plain[s.start] == POWERLINE_SEP]
|
||||
assert seams[0] == f"{hue} on {_style_hex(node_style('77'))}" # blended, one cell
|
||||
|
||||
dimmed = PathLine([PathHop("A", dim=True), PathHop("B", dim=True)], mode="powerline")
|
||||
text = dimmed.text()
|
||||
gaps = [str(s.style) for s in text.spans if text.plain[s.start] == POWERLINE_SEP]
|
||||
assert " on " not in gaps[0] # a dimmed return leg reads as hops, not one bar
|
||||
assert _seams(PathHop("A", key="aa"), PathHop("B", key="aa"))[0] == (
|
||||
POWERLINE_THIN,
|
||||
f"{_CHIP_FG} on {hue}",
|
||||
)
|
||||
assert _seams(PathHop("A", key="aa"), PathHop("B", key="77"))[0] == (
|
||||
POWERLINE_SEP,
|
||||
f"{hue} on {_style_hex(node_style('77'))}",
|
||||
) # blended, one cell
|
||||
assert _seams(PathHop("A", dim=True), PathHop("B", dim=True))[0] == (
|
||||
POWERLINE_THIN,
|
||||
f"{_DIM_FG} on {_DIM_BG}",
|
||||
) # a dimmed return leg reads as hops, not one bar, and recedes with them
|
||||
|
||||
|
||||
def _seam_styles(*hops: PathHop) -> list[str]:
|
||||
text = PathLine(list(hops), mode="powerline").text()
|
||||
return [str(s.style) for s in text.spans if text.plain[s.start] == POWERLINE_SEP]
|
||||
|
||||
|
||||
def test_a_seam_between_two_near_hues_falls_back_to_the_page_too() -> None:
|
||||
def test_a_seam_between_two_near_hues_is_the_thin_chevron_too() -> None:
|
||||
"""Two hues under ``SEAM_HUE_GAP`` apart on the wheel blend like an exact match.
|
||||
|
||||
The wheel is the first key byte, so the gap is a byte difference — and a circular
|
||||
@@ -680,22 +689,21 @@ def test_a_seam_between_two_near_hues_falls_back_to_the_page_too() -> None:
|
||||
distinct greys are two distinct fills and the chevron between them still reads.
|
||||
"""
|
||||
hue = _style_hex(node_style("a0"))
|
||||
assert _seam_styles(PathHop("A", key="a0"), PathHop("B", key="af"))[0] == hue
|
||||
assert _seam_styles(PathHop("A", key="af"), PathHop("B", key="a0"))[0] == _style_hex(
|
||||
node_style("af")
|
||||
)
|
||||
assert _seam_styles(PathHop("A", key="f8"), PathHop("B", key="04"))[0] == _style_hex(
|
||||
node_style("f8")
|
||||
) # the wheel wraps
|
||||
assert _seam_styles(PathHop("A", key="a0"), PathHop("B", key="b0"))[0] == (
|
||||
f"{hue} on {_style_hex(node_style('b0'))}"
|
||||
thin = lambda key: (POWERLINE_THIN, f"{_CHIP_FG} on {_style_hex(node_style(key))}") # noqa: E731
|
||||
assert _seams(PathHop("A", key="a0"), PathHop("B", key="af"))[0] == thin("af")
|
||||
assert _seams(PathHop("A", key="af"), PathHop("B", key="a0"))[0] == thin("a0")
|
||||
assert _seams(PathHop("A", key="f8"), PathHop("B", key="04"))[0] == thin("04") # wraps
|
||||
assert _seams(PathHop("A", key="a0"), PathHop("B", key="b0"))[0] == (
|
||||
POWERLINE_SEP,
|
||||
f"{hue} on {_style_hex(node_style('b0'))}",
|
||||
) # exactly the gap apart: distinct
|
||||
assert _seam_styles(PathHop("A", key="a0"), PathHop("B", key="20"))[0] == (
|
||||
f"{hue} on {_style_hex(node_style('20'))}"
|
||||
assert _seams(PathHop("A", key="a0"), PathHop("B", key="20"))[0] == (
|
||||
POWERLINE_SEP,
|
||||
f"{hue} on {_style_hex(node_style('20'))}",
|
||||
) # opposite sides of the wheel
|
||||
|
||||
mixed = _seam_styles(PathHop("A"), PathHop("B", dim=True))
|
||||
assert " on " in mixed[0] # keyless grey on dim slate: two greys, still interlocked
|
||||
glyph, style = _seams(PathHop("A"), PathHop("B", dim=True))[0]
|
||||
assert glyph == POWERLINE_SEP and " on " in style # two greys, still interlocked
|
||||
|
||||
|
||||
def test_bare_self_stands_us_on_a_star_and_fades_both_ends() -> None:
|
||||
|
||||
Reference in new issue
Block a user