The clip arrows lead the bar, and say it in colour

They rode the PicoCalc title bar's tail, appearing and disappearing with the
scroll — and a half-shown pair put a blank cell where the missing arrow would
be, so reading it meant comparing the row against a memory of itself. Both
arrows now sit at the left edge, where the eye starts, and never move: an arrow
whose direction has more takes the border's own accent, one with nothing that
way drops to muted. That is the live/dim language the F-key lane already draws
one row below, and the bar keeps its width whatever the body is doing.

The Esc atom keeps the tail it was given, now on its own — a hair more room for
a long title, since the two arrow cells left that end of the row.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Opus 5 committed 2026-08-31 03:20:48 -04:00
1 parent d28240f658
commit 8fc24d4901
3 files changed
+94 -38

No files matched your search

+7
View File
@@ -313,6 +313,13 @@ One codebase, two flavours: **regular** (desktop/ssh, 72 cols, truecolor, emoji)
once at boot; consumers bind at platform-switch time via `platforms.on_platform` — never
branch on the platform per frame, and never `from meshterm.platforms import PLATFORM`.
- The borderless title bar (`frame._title_bar`) is this platform's whole panel border:
`↑↓ ──── Title ─────── Esc back`. The **clip arrows lead the row and are always both
drawn** — colour reads the scroll (the border's `accent` where that direction has more,
`muted` where it doesn't), the same live/dim language the lane draws one row below. A
pair that appeared and vanished, half of it a blank cell, asked the reader to compare
the row against a memory of itself; fixed furniture means the bar never changes width
as the body scrolls either.
- **Never emit a raw emoji or bare hex colour into picocalc output.** Icons go through
`theme.glyph()` (the compact map); everything else is caught by the render-boundary
fold (`theme.fold_text`, applied in `tui/render.render_to_ansi` and
+37 -31
View File
@@ -198,50 +198,56 @@ def _esc_hint(hint: str) -> str:
def _title_bar(screen: Screen, cols: int, more_above: bool, more_below: bool) -> Text:
"""The borderless frame's one-row title bar: a centered title on a bold rule, clip arrows.
"""The borderless frame's one-row title bar: clip arrows, a centered title, the way out.
The Panel border's whole vocabulary — where you are (title) and whether the list
The Panel border's whole vocabulary — where you are (title) and whether the body
continues (the ``↑↓ more`` subtitle) — compressed into a single row so the body wins
back three rows and four columns on the PicoCalc. Shape:
``──── Title ─────── ↑↓ · Esc back``, echoing
``↑↓ ──── Title ─────── Esc back``, echoing
:func:`~meshterm.ui.menus.section_heading`'s heading language.
The title is centered in the rule exactly as Rich's ``Panel`` centers its own
``title`` by default — the desktop's bordered frame this one stands in for. The
rule itself takes ``border_style`` (``"accent"``) directly — the same bold weight a
real border draws in — rather than :func:`~meshterm.ui.theme.hint_style`'s muted
variant, which is for auxiliary text riding *alongside* a border (a footer hint, the
subtitle's own "more" label below), not the border's own glyphs. The ``↑↓`` clip
arrows keep that muted hint style, matching a bordered panel's own subtitle.
**The clip arrows lead the row, and both are always drawn** (JP, 2026-08-31). A pair
that appeared and vanished — and, half-shown, left a blank cell standing in for the
arrow that wasn't there — made the reader compare the row against a memory of itself
to learn something the row could simply state. So the pair is fixed furniture at the
left edge, where the eye starts, and **colour** carries the reading: an arrow whose
direction has more takes the border's own ``accent``, so it reads as part of the
frame; one with nothing that way drops to ``muted``. That is the same live/dim
language the F-key lane draws one row below (a dim chip keeps its label and loses its
fill), and the two are the platform's only two indicators.
The bar's tail also carries **the way out** (JP, 2026-08-30). This platform has no
footer hint line — the F-key lane stands where it would be, and the lane advertises
only what its five slots do — so nothing on the screen said that Esc leaves, which is
the one key every screen answers to and the reason no screen spends a row on a *Back*
item. It rides here in the same muted hint style as the arrows, in the same
``↑↓ · hint`` shape a floating dialog's subtitle already uses, and it is **last** on
the row because that is where the footer's grammar puts it. The verb is the screen's
own (:func:`_esc_hint` lifts the atom off its footer hint, so a value picker says
``keep`` and the main menu says ``quit``); a screen whose hint names no Esc gets
nothing. Compact by construction: where a long title would be crowded, the atom drops
to a bare ``Esc`` and then out altogether — the title is what the reader came for.
The title is centered in the rule between the arrows and the tail, exactly as Rich's
``Panel`` centers its own ``title`` — the desktop's bordered frame this one stands in
for. The rule itself takes ``border_style`` (``"accent"``) directly, the same bold
weight a real border draws in, rather than :func:`~meshterm.ui.theme.hint_style`'s
muted variant, which is for auxiliary text riding *alongside* a border (the Esc atom
below, a footer hint on the other platform).
The bar's tail carries **the way out** (JP, 2026-08-30). This platform has no footer
hint line — the F-key lane stands where it would be, and the lane advertises only what
its five slots do — so nothing on the screen said that Esc leaves, which is the one key
every screen answers to and the reason no screen spends a row on a *Back* item. The
verb is the screen's own (:func:`_esc_hint` lifts the atom off its footer hint, so a
value picker says ``keep`` and the main menu says ``quit``); a screen whose hint names
no Esc gets nothing. Compact by construction: where a long title would be crowded, the
atom drops to a bare ``Esc`` and then out altogether — the title is what the reader
came for, and the arrows are two cells nothing else can spend.
"""
border = "accent"
arrows = ""
if more_above or more_below:
arrows = ("↑" if more_above else " ") + ("↓" if more_below else " ")
head_span = 3 # the arrow pair, plus the space parting it from the rule
label_w = cell_len(screen.title) + 2 if screen.title else 0 # a space either side
atom = _esc_hint(screen.footer_hint)
for esc in (atom, "Esc" if atom else "", ""):
tail = " · ".join(part for part in (arrows, esc) if part)
tail_span = cell_len(tail) + 1 if tail else 0 # the space in front of the tail
if not esc or cols - tail_span - label_w >= 2 * _MIN_RULE:
tail_span = cell_len(esc) + 1 if esc else 0 # the space in front of the tail
if not esc or cols - head_span - tail_span - label_w >= 2 * _MIN_RULE:
break
rule_span = max(0, cols - tail_span)
rule_span = max(0, cols - head_span - tail_span)
bar = Text()
bar.append("↑", style=border if more_above else "muted")
bar.append("↓", style=border if more_below else "muted")
bar.append(" ")
if screen.title:
label_w = cell_len(screen.title) + 2 # a space padding it on either side
left = max(1, (rule_span - label_w) // 2)
right = max(1, rule_span - label_w - left)
bar.append("─" * left, style=border)
@@ -251,8 +257,8 @@ def _title_bar(screen: Screen, cols: int, more_above: bool, more_below: bool) ->
bar.append("─" * right, style=border)
else:
bar.append("─" * rule_span, style=border)
if tail:
bar.append(" " + tail, style=hint_style(border))
if esc:
bar.append(" " + esc, style=hint_style(border))
bar.truncate(cols)
return bar
+50 -7
View File
@@ -47,11 +47,26 @@ def test_borderless_frame_swaps_the_panel_for_a_title_bar() -> None:
assert plain[2].startswith("row 0")
def _bar(title: str, hint: str, cols: int = 53, *, below: bool = True) -> str:
"""The borderless title bar's plain text for a screen with ``title`` and ``hint``."""
def _bar_text(title: str, hint: str, cols: int = 53, *, above: bool = False,
below: bool = True) -> Text:
"""The borderless title bar for a screen with ``title`` and ``hint``, as styled Text."""
screen = ScrollScreen(Text("x"), title=title, floating=False)
screen._footer_hint = hint
return frame._title_bar(screen, cols, False, below).plain
return frame._title_bar(screen, cols, above, below)
def _bar(title: str, hint: str, cols: int = 53, *, below: bool = True) -> str:
"""The borderless title bar's plain text for a screen with ``title`` and ``hint``."""
return _bar_text(title, hint, cols, below=below).plain
def _arrow_styles(bar: Text) -> tuple[str, str]:
"""The styles the bar painted on its two clip arrows, ``(up, down)``."""
return tuple(
next(str(span.style) for span in bar.spans
if span.start <= index < span.end and span.end - span.start == 1)
for index in (0, 1)
)
def test_the_title_bar_says_how_to_leave_the_screen() -> None:
@@ -59,15 +74,43 @@ def test_the_title_bar_says_how_to_leave_the_screen() -> None:
The F-key lane stands where the footer would be and only advertises what its slots do,
which left Esc — the key every screen answers to, and the reason no screen carries a
*Back* row — completely unadvertised (JP, 2026-08-30). It lands last, after the clip
arrows, in the ``↑↓ · hint`` shape a floating dialog's subtitle already uses.
*Back* row — completely unadvertised (JP, 2026-08-30). It lands last, past the title,
with the clip arrows holding the row's other end.
"""
bar = _bar("Chrome probe", "↑↓ move · Enter open · Esc back")
assert bar.rstrip().endswith("↓ · Esc back")
assert bar.startswith("↑↓ ")
assert bar.rstrip().endswith("Esc back")
assert "Chrome probe" in bar
def test_the_clip_arrows_are_always_drawn_and_say_it_in_colour() -> None:
"""Both arrows are fixed furniture at the row's left edge; colour reads the scroll.
They used to appear and vanish, and a half-shown pair left a blank cell standing in
for the missing one — the reader had to compare the row against a memory of itself
(JP, 2026-08-31). Now the pair never moves and never changes width, and an arrow
whose direction has more takes the border's own accent while one with nothing that way
drops to muted: the F-key lane's live/dim language, one row up.
"""
hint = "↑↓ move · Esc back"
assert _arrow_styles(_bar_text("Contacts", hint, above=True, below=True)) == (
"accent", "accent")
assert _arrow_styles(_bar_text("Contacts", hint, above=False, below=True)) == (
"muted", "accent")
assert _arrow_styles(_bar_text("Contacts", hint, above=True, below=False)) == (
"accent", "muted")
# A body that fits whole keeps the pair, both dim — nothing appears or disappears.
assert _arrow_styles(_bar_text("Contacts", hint, above=False, below=False)) == (
"muted", "muted")
widths = {
_bar_text("Contacts", hint, above=a, below=b).plain
for a in (False, True) for b in (False, True)
}
assert len(widths) == 1, "the bar's text must not shift as the body scrolls"
def test_the_bar_speaks_the_screen_s_own_esc_verb() -> None:
"""Lifted off the screen's own footer hint, so each surface keeps its true verb."""
assert _bar("MeshTerm", "↑↓ move · Enter open · Esc quit").endswith("Esc quit")
@@ -83,7 +126,7 @@ def test_the_esc_hint_gives_way_before_it_crowds_the_title() -> None:
takes the cells back altogether. The title is what the reader came for.
"""
verbless = _bar("Trace — YUL-Cartierville over a spec", "↑↓ move · Esc back")
assert verbless.rstrip().endswith("· Esc") # the verb went, the key stayed
assert verbless.rstrip().endswith(" Esc") # the verb went, the key stayed
assert "Esc back" not in verbless
crowded = _bar("Trace — YUL-Cartierville over a longer spec", "↑↓ move · Esc back")