Node page: a tab is one press - F1 Info, F2 Routes

The F3 next-tab toggle gave way to one chip per view in strip order;
the tab on screen dims (its key would change nothing this paint), and
Tab/Shift+Tab still cycle.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Fable 5 committed 2026-08-08 19:11:45 -04:00
1 parent 3b075149ce
commit 192179d79f
2 files changed
+32 -16

No files matched your search

+24 -12
View File
@@ -340,16 +340,15 @@ class NodeDetailScreen(Screen):
@property
def fkey_lane(self):
"""The shared pager over the route list, plus the tab switch on F3.
"""The shared pager over the route list, plus one chip per tab on F1/F2.
The strip shows *that* there are two views; nothing on screen says the key that
moves between them, and on a platform with no hint line the chip is the only place
to learn it. It names the tab it would take you *to*, never the one you are on —
the strip already marks that, and a chip repeating it would say nothing about what
pressing it does. Unlike the Time Machine's window chip, this one carries no ``▸``
lead-in: ``Routes`` is exactly six cells on its own, and the strip beside it makes
the direction plain anyway. A page with one tab has nothing to switch, so the slot
stays empty.
moves between them, and on a platform with no hint line the chips are the only
place to learn it. Each tab takes its own slot in strip order — F1 ``Info``, F2
``Routes`` (JP, 2026-08-08) — so a view is one press away rather than a toggle to
cycle. The chip you are already on dims: the view is a thing here, pressing its
key just changes nothing this paint. A page with one tab has nothing to switch,
so the slots stay empty.
The pager gates on the route list actually being windowed: on the Info tab, and on
a node whose routes all fit, the keys move nothing.
@@ -358,8 +357,8 @@ class NodeDetailScreen(Screen):
lane = list(default_lane(nav=self._list_hidden))
if len(self._tabs) >= 2:
nxt = self._tabs[(self._tab_index + 1) % len(self._tabs)]
lane[2] = FPair(nxt.name, "tab")
for i, tab in enumerate(self._tabs[:3]):
lane[i] = FPair(tab.name, f"tab_{i}", enabled=i != self._tab_index)
return lane
def __init__(
@@ -559,6 +558,9 @@ class NodeDetailScreen(Screen):
self._switch_tab(1)
elif action == "shift_tab":
self._switch_tab(-1)
elif action.startswith("tab_") and action[4:].isdigit():
# The lane's per-tab chips (F1 Info, F2 Routes) land on a view directly.
self._select_tab(int(action[4:]))
elif action == "up":
if n:
self._row_index = (self._row_index - 1) % n
@@ -609,10 +611,20 @@ class NodeDetailScreen(Screen):
return self._cursor
def _switch_tab(self, delta: int) -> None:
"""Move the active tab, resetting the cursor and list window to that tab's top."""
"""Cycle the active tab (``Tab``/``Shift+Tab``); a lone tab has nowhere to go."""
if len(self._tabs) < 2:
return
self._tab_index = (self._tab_index + delta) % len(self._tabs)
self._select_tab((self._tab_index + delta) % len(self._tabs))
def _select_tab(self, index: int) -> None:
"""Land the stage on tab ``index``, resetting the cursor and list window to its top.
A no-op off the strip or on the tab already showing, so the lane's dimmed
current-tab chip stays presentational — ``handle`` remains the authority.
"""
if not (0 <= index < len(self._tabs)) or index == self._tab_index:
return
self._tab_index = index
self._row_index = 0
self._route_sel = 0
self._list_top = 0
+8 -4
View File
@@ -844,13 +844,17 @@ def test_node_detail_screen_tabs_switch_the_stage() -> None:
assert "│ Info │" in body and "centred here" in body
assert screen.consume_edge_scrub() == 2
# The F-key chip names where the switch would take you, so it flips with the stage.
assert screen.fkey_lane[2].label == "Routes"
screen.handle("tab") # switch to the Routes tab
# One F-key chip per tab, in strip order; the tab on screen dims (its key would
# change nothing), and pressing the other's chip lands on that view directly.
assert [pair.label for pair in screen.fkey_lane[:2]] == ["Info", "Routes"]
assert screen.fkey_lane[0].enabled is False and screen.fkey_lane[1].enabled is True
screen.handle("tab_1") # the F2 chip: land on the Routes tab
body = _plain(screen.render_body(72))
assert "│ Routes │" in body and "no route observed yet" in body
assert screen.consume_edge_scrub() == 0 # the braille preview isn't showing now
assert screen.fkey_lane[2].label == "Info"
assert screen.fkey_lane[0].enabled is True and screen.fkey_lane[1].enabled is False
screen.handle("tab") # Tab still cycles, wrapping back to Info
assert screen.fkey_lane[0].enabled is False
def test_node_detail_single_tab_hides_the_switch_hint() -> None: