F-key lane: a directional pair rises to the right, like a rocker

Where two adjacent chips are opposite ends of one axis, the up/in/more end
now takes the right slot: the map reads Zoom - then Zoom +, the shared lane
Bottom/Top and Page down/Page up, and the chat's relabelled jump pair follows
with Latest/Oldest. The actions move with their labels, so one handedness
carries across every screen and F1 always means the near end.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Opus 5 committed 2026-08-08 03:15:13 -04:00
1 parent 5268892780
commit 5a9015662b
7 files changed
+47 -29

No files matched your search

+4 -1
View File
@@ -193,7 +193,10 @@ branch on the platform per frame, and never `from meshterm.platforms import PLAT
paired opposites (physical Shift+F1..F5), labels ≤7 cells. Screens override
`fkey_lane` for their own verbs; slots 3/4 are the customary free pair. **A chip names
an action, never a key** — `Page ↑`, not `PgUp`; `Latest` on a transcript; `Reset` on
the map, whose Home refits and whose paging zooms. The lane *is* the footer here, so it
the map, whose Home refits and whose paging zooms. **A directional pair rises to the
right**: where two adjacent chips are opposite ends of one axis (F1/F2's jumps, F4/F5's
paging, the map's zoom, a chat's latest/oldest), the *up · in · more* end takes the
right slot — `Zoom -` then `Zoom +`, a rocker. The lane *is* the footer here, so it
obeys the hint line's rule — never advertise a key that would do nothing. Empty and dim
are different claims: leave the slot **empty** when the action isn't a thing on this
screen (Retry in a channel), and clear `enabled`/`opp_enabled` to draw it **dim** (label
+11 -8
View File
@@ -80,16 +80,19 @@ class ChatScreen(Screen):
@property
def fkey_lane(self):
"""The PicoCalc lane in the transcript's own words: Oldest/Latest, Paths, Retry.
"""The PicoCalc lane in the transcript's own words: Latest/Oldest, Paths, Retry.
The default lane's F1/F2 dispatch the plain ``home``/``end`` actions, but here
The default lane's F1/F2 dispatch the plain ``end``/``home`` actions, but here
those are already claimed by the compose line's cursor (see :meth:`handle`) — so
without an override, both keys land on the same "clear the pick, stick to the
tail" fallthrough and read as if either one scrolls to the bottom. F1/F2 dispatch
``ctrl_home``/``ctrl_end`` instead, and say what those do to a conversation:
reach back to the *oldest* message, or return to the *latest* and the compose
line. F4/F5 keep the shared paging pair, which is what a screenful of transcript
looks like from the outside even though it is the pick that moves.
``ctrl_end``/``ctrl_home`` instead, and say what those do to a conversation:
return to the *latest* message and the compose line, or reach back to the
*oldest*. That is the shared pair relabelled, so it keeps the shared handedness —
the far end of the scroll-up axis on the right (see
:data:`~meshterm.ui.tui.fkeys.DEFAULT_LANE`). F4/F5 keep the shared paging pair,
which is what a screenful of transcript looks like from the outside even though it
is the pick that moves.
The F3 pair follows the lane's two claims. *Retry* is absent in a channel — a
channel message is never acknowledged, so there is no such thing to retry there —
@@ -100,8 +103,8 @@ class ChatScreen(Screen):
lane = list(default_lane(nav=bool(self._messages)))
live = bool(self._messages)
lane[0] = FPair("Oldest", "ctrl_home", enabled=live)
lane[1] = FPair("Latest", "ctrl_end", enabled=live)
lane[0] = FPair("Latest", "ctrl_end", enabled=live)
lane[1] = FPair("Oldest", "ctrl_home", enabled=live)
retry = ("Retry", "retry") if not self._is_channel else ("", "")
lane[2] = FPair(
"Paths", "paths", *retry,
+5 -2
View File
@@ -88,14 +88,17 @@ class MapScreen(Screen):
would label those keys as paging and offer a fifth that does nothing, so the map
names its own verbs and leaves F2 unassigned. All three are always live — a map
can always zoom or refit — so no slot dims.
The zoom pair keeps the lane's handedness (see :data:`~meshterm.ui.tui.fkeys.DEFAULT_LANE`):
out on the left, in on the right, so F4/F5 read as the ``−``/``+`` rocker they are.
"""
from .tui.fkeys import DEFAULT_LANE, FPair
lane = list(DEFAULT_LANE)
lane[0] = FPair("Reset", "home")
lane[1] = None # End does nothing on a map
lane[3] = FPair("Zoom +", "pageup")
lane[4] = FPair("Zoom -", "pagedown")
lane[3] = FPair("Zoom -", "pagedown")
lane[4] = FPair("Zoom +", "pageup")
return lane
def __init__(
+8 -2
View File
@@ -97,12 +97,18 @@ Lane = Sequence[Optional[FPair]]
#: :attr:`~meshterm.ui.tui.screen.Screen.fkey_lane` override reaches for first — typically
#: a Ctrl+letter chord promoted up because chording is a pain here. A screen whose body is
#: not one scrolling column says so in its own words (see :class:`ChatScreen`, ``MapScreen``).
#:
#: **A directional pair rises to the right** (JP, 2026-08-08): wherever two adjacent chips
#: are opposite ends of one axis — the F1/F2 jumps and the F4/F5 pager here, the map's zoom,
#: a chat's oldest/latest — the *up · in · more* end takes the right slot and its opposite
#: the left, so every such pair reads like a rocker (``−`` then ``+``) and one handedness
#: carries across screens. A screen relabelling a pair keeps that order.
DEFAULT_LANE: tuple[Optional[FPair], ...] = (
FPair("Top", "home"),
FPair("Bottom", "end"),
FPair("Top", "home"),
None,
FPair("Page ↑", "pageup"),
FPair("Page ↓", "pagedown"),
FPair("Page ↑", "pageup"),
)
+5 -4
View File
@@ -908,10 +908,11 @@ def test_chat_fkey_lane_speaks_the_transcript_and_drops_channel_retry() -> None:
messages = [ChatMessage(text="hi", peer="d4e5f6a7")]
direct = _screen(_StubSession(), send=None, messages=messages)
# Not "Top"/"End": what these do to a conversation is reach its oldest message, or
# come back to the latest one and the compose line.
assert [pair.label for pair in direct.fkey_lane[:2]] == ["Oldest", "Latest"]
assert [pair.action for pair in direct.fkey_lane[:2]] == ["ctrl_home", "ctrl_end"]
# Not "Bottom"/"Top": what these do to a conversation is come back to the latest
# message and the compose line, or reach back to its oldest one. Same handedness as
# the shared pair they relabel — the far end of the scroll-up axis on the right.
assert [pair.label for pair in direct.fkey_lane[:2]] == ["Latest", "Oldest"]
assert [pair.action for pair in direct.fkey_lane[:2]] == ["ctrl_end", "ctrl_home"]
assert direct.fkey_lane[2].opp_label == "Retry"
channel = ChatScreen(
+3 -2
View File
@@ -1134,11 +1134,12 @@ def test_map_fkey_lane_names_zoom_and_drops_the_dead_slot() -> None:
# PgUp/PgDn zoom here and Home refits — the shared "Top/End/PgUp/PgDn" labels would
# all be lies, and "end" is bound to nothing at all.
# The zoom pair rises to the right, like every directional pair on the lane.
assert [pair.label if pair else None for pair in lane] == [
"Reset", None, None, "Zoom +", "Zoom -",
"Reset", None, None, "Zoom -", "Zoom +",
]
assert action_for(lane, 2) is None # F2 offers nothing rather than a dead End
assert action_for(lane, 1) == "home" and action_for(lane, 4) == "pageup"
assert action_for(lane, 1) == "home" and action_for(lane, 5) == "pageup"
assert all(pair.enabled for pair in lane if pair) # a map can always zoom or refit
+11 -10
View File
@@ -83,11 +83,11 @@ def test_picocalc_header_brands_the_app_not_the_device() -> None:
def test_fkey_lane_resolution_and_banks() -> None:
lane = DEFAULT_LANE
# F4/F5 (paging — no physical key at all) are plain-key only, no Shift companion.
assert action_for(lane, 4) == "pageup" and action_for(lane, 9) is None
assert action_for(lane, 5) == "pagedown" and action_for(lane, 10) is None
# F1/F2 carry the Fn-layered jump-to-top/end pair, also with no Shift companion.
assert action_for(lane, 1) == "home" and action_for(lane, 6) is None
assert action_for(lane, 2) == "end" and action_for(lane, 7) is None
assert action_for(lane, 4) == "pagedown" and action_for(lane, 9) is None
assert action_for(lane, 5) == "pageup" and action_for(lane, 10) is None
# F1/F2 carry the Fn-layered jump-to-end/top pair, also with no Shift companion.
assert action_for(lane, 1) == "end" and action_for(lane, 6) is None
assert action_for(lane, 2) == "home" and action_for(lane, 7) is None
# F3 is the lone, unassigned slot a screen's own lane fills in.
assert action_for(lane, 3) is None and action_for(lane, 8) is None
# Enter/Esc never occupy a slot — both keys are already close at hand.
@@ -99,8 +99,9 @@ def test_fkey_lane_text_fits_and_flips() -> None:
primary = lane_text(DEFAULT_LANE)
shifted = lane_text(DEFAULT_LANE, shifted=True)
assert cell_len(primary.plain) == 53 and cell_len(shifted.plain) == 53
assert "F1 Top" in primary.plain # the chips name actions, not the keys they sit on
assert "F4 Page ↑" in primary.plain and "F5 Page ↓" in primary.plain
assert "F1 Bottom" in primary.plain # the chips name actions, not the keys they sit on
# A directional pair rises to the right: down/out left, up/in right.
assert "F4 Page ↓" in primary.plain and "F5 Page ↑" in primary.plain
# No slot has a Shift companion by default: the whole shifted bank renders unfilled.
for number in (6, 7, 8, 9):
assert f"F{number}" in shifted.plain
@@ -131,10 +132,10 @@ def test_default_lane_dims_every_nav_slot_when_nothing_moves() -> None:
assert default_lane() is DEFAULT_LANE # the live lane is the constant itself
dim = default_lane(nav=False)
assert [pair.label for pair in dim if pair] == ["Top", "Bottom", "Page ↑", "Page ↓"]
assert [pair.label for pair in dim if pair] == ["Bottom", "Top", "Page ↓", "Page ↑"]
assert not any(pair.enabled for pair in dim if pair)
row = lane_text(dim)
assert cell_len(row.plain) == 53 and "F1 Top" in row.plain and "F5 Page ↓" in row.plain
assert cell_len(row.plain) == 53 and "F1 Bottom" in row.plain and "F5 Page ↑" in row.plain
assert {str(span.style) for span in row.spans} == {"muted"}
@@ -151,7 +152,7 @@ def test_lane_is_built_after_the_body_renders() -> None:
composed = frame.compose_base(Text("hdr"), screen, "hint", 53, 26, footer_lane=build)
assert seen["nav"] is True # lit on the very first paint, with no stale frame to lag
assert "F4 Page ↑" in _plain(composed.split("\n")[-1])
assert "F4 Page ↓" in _plain(composed.split("\n")[-1])
def test_scroll_screen_lane_tracks_whether_its_body_overflows() -> None: