A channel, a DM, and a room share one F-key lane, and the day jump leaves it
F1-F3 hold what the three conversations share, in the hint's order: Paths, QR, Map. The Shift bank holds each screen's own verbs: ^R on Shift+F1 (Retry in a DM and a room, Resend in a channel) and the room's Log in on Shift+F2. F4/F5 stay the pager with Latest/Oldest behind Shift. Day ↑ and Day ↓ are gone from the lane; the desktop keeps the day jump on ^PgUp/^PgDn. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f07bb9e1dd
commit
444b0ea669
6 files changed
+149
-138
No files matched your search
@@ -773,7 +773,14 @@ branch on the platform per frame, and never `from meshterm.platforms import PLAT
|
||||
the authority and no-ops. The lane is also the *only* affordance advertisement here, so
|
||||
anything the desktop reaches by a chord or a bare letter (a list's `^PgUp/^PgDn` section
|
||||
jumps, the Time Machine's `w`, the map's `^L`, a row's `Del`) earns a slot — otherwise
|
||||
it is undiscoverable on the device.
|
||||
it is undiscoverable on the device. One exception, by JP's choice (2026-10-10): the
|
||||
chat's day jump (`^PgUp/^PgDn`) has no chip; `Day ↑`/`Day ↓` were taken off F1/F2.
|
||||
- **The three conversations share one lane** (channel, DM, room; JP, 2026-10-10): what
|
||||
they share sits on F1–F3 plain, in the hint's order — `Paths` (^P), `QR` (^U), `Map`
|
||||
(^L, empty without a locator) — and each screen's own verbs ride the Shift bank: ^R on
|
||||
Shift+F1 (`Retry` in a DM and a room, `Resend` in a channel), the room's `Log in` (^O)
|
||||
on Shift+F2. F4/F5 stay the pager, with `Latest`/`Oldest` behind Shift. A verb new to
|
||||
one of them goes on the Shift bank; one all three gain goes on the plain bank.
|
||||
- **Each handheld deals its own lane.** Everything about the lane that belongs to one
|
||||
keyboard is a `LaneDeck` (`fkeys.PICOCALC_LYRA_DECK`, `fkeys.CARDPUTER_ZERO_DECK`), named by
|
||||
`Platform.lane_deck`: which keycodes drive the slots, where the chips sit on the row, how
|
||||
|
||||
+43
-71
@@ -129,95 +129,67 @@ class ChatScreen(Screen):
|
||||
|
||||
@property
|
||||
def picocalc_lyra_lane(self):
|
||||
"""The PicoCalc lane in the words of the transcript: Latest/Oldest, Paths, Retry.
|
||||
"""The PicoCalc lane of a conversation: the same lane in a channel, a DM, and a room.
|
||||
|
||||
The Shift bank of the shared lane sends the plain ``end``/``home`` actions. But
|
||||
here the cursor of the compose line already uses them (refer to :meth:`handle`).
|
||||
Thus, without a change, the two keyboard keys go to the same fallback ("clear the
|
||||
selection, stay at the tail"), and each one seems to scroll to the bottom. Instead,
|
||||
the two Shift slots send ``ctrl_end``/``ctrl_home``, and their labels say what
|
||||
these actions do to a conversation: go back to the *latest* message and the
|
||||
compose line, or go back to the *oldest*. This is the shared pair with new labels
|
||||
in the same slots. Thus it keeps the shared sides: each jump is still behind the
|
||||
page key that goes in the same direction (refer to
|
||||
:data:`~meshterm.ui.tui.fkeys.DEFAULT_LANE`). F4/F5 keep the shared paging pair.
|
||||
From the outside, the transcript moves by one screen, also when it is the selection
|
||||
that moves.
|
||||
The plain bank of F1 to F3 has the verbs that all three screens share, in the order
|
||||
of the hint: ``Paths`` (^P), ``QR`` (^U), and ``Map`` (^L). The Shift bank of F1 to
|
||||
F3 has the verbs of one screen only. ``Retry`` (^R) is on the Shift half of F1 in a
|
||||
DM and in a room, and ``Resend`` (the same ^R, unscoped) is there in a channel. A
|
||||
room adds ``Log in`` (^O) on the Shift half of F2 (refer to
|
||||
:class:`~meshterm.ui.room.RoomScreen`). Thus a key does the same thing on each of
|
||||
the three screens, and the user finds a verb in the same place (JP, 2026-10-10).
|
||||
|
||||
The F3 pair follows the two rules of the lane. *Retry* is not there in a channel,
|
||||
because a channel message is never acknowledged, so there is nothing to retry. In
|
||||
a direct chat with nothing outstanding, it is only dim. The Shift slot of a channel
|
||||
is *Resend* instead: the selected message (or the newest) again, unscoped (refer
|
||||
to :meth:`_retry_target`). It is there when a resend is connected, and it is dim
|
||||
until that message is one of ours that went out under a region. *Paths* must have
|
||||
a selected message to show the paths of, and the two navigation slots must have a
|
||||
transcript to move through.
|
||||
The three shared verbs act *on* the selected message. ``Paths`` is lit while a
|
||||
message is selected. ``QR`` shows the codes of the links of the selection on a
|
||||
share screen, larger than the codes under it in the transcript, and is lit while the
|
||||
selection has a URL (refer to :meth:`_picked_urls`). ``Map`` is lit while the author
|
||||
of the selection has a location (refer to :meth:`_locate_target`), and its slot is
|
||||
empty when the screen has no locator.
|
||||
|
||||
F1/F2 have the **day** jump: the section step of the transcript (its dividers are
|
||||
days). A grouped select list does the same with ``Sect ↑``/``Sect ↓``, on the same
|
||||
keyboard keys, which send the same ``ctrl_pageup``/``ctrl_pagedown``. The label
|
||||
names what the sections *are* here, because of the lane rule that a chip names an
|
||||
action. A left-hand pair rises toward F1. Thus ``Day ↑`` (back through the
|
||||
transcript) is on the outer side of ``Day ↓``, the same as the pager on the right
|
||||
and the list that it copies. These chips are lit only when there is more than one
|
||||
day to step between. A conversation in one afternoon has no sections, the same as
|
||||
a list with one section.
|
||||
The Shift half of F1 follows the two rules of the lane. In a channel with no
|
||||
resend connected, it is empty, because a channel message is never acknowledged and
|
||||
there is nothing to retry. In a DM with nothing outstanding, it is only dim.
|
||||
``Resend`` sends the selected message (or the newest) again, unscoped (refer to
|
||||
:meth:`_retry_target`), and it is dim until that message is one of ours that went
|
||||
out under a region.
|
||||
|
||||
``QR`` (^U) is on the Shift half of F2, next to ``Retry`` on the Shift half of F3.
|
||||
The two are actions *on* the selected message: the codes of its links on a share
|
||||
screen, larger than the codes under it in the transcript. ``QR`` is lit while the
|
||||
selection has a URL.
|
||||
The day jump (``ctrl_pageup``/``ctrl_pagedown``) has no chip. ``Day ↑`` and
|
||||
``Day ↓`` were on F1 and F2, and JP removed them (2026-10-10). The desktop keeps
|
||||
the jump on ^PgUp and ^PgDn.
|
||||
|
||||
``Map`` (^L) is on the Shift half of F1, the one slot that the rest of the lane
|
||||
leaves free. It is lit while the author of the selected message has a location
|
||||
(refer to :meth:`_locate_target`). The room puts ``Log in`` in that slot instead
|
||||
(refer to :class:`~meshterm.ui.room.RoomScreen`).
|
||||
F4/F5 keep the shared paging pair. The Shift bank of the shared lane sends the plain
|
||||
``end``/``home`` actions. But here the cursor of the compose line already uses them
|
||||
(refer to :meth:`handle`). Thus, without a change, the two keyboard keys go to the
|
||||
same fallback ("clear the selection, stay at the tail"), and each one seems to
|
||||
scroll to the bottom. Instead, the two Shift slots send ``ctrl_end``/``ctrl_home``,
|
||||
and their labels say what these actions do to a conversation: go back to the
|
||||
*latest* message and the compose line, or go back to the *oldest*. Each jump is
|
||||
still behind the page key that goes in the same direction (refer to
|
||||
:data:`~meshterm.ui.tui.fkeys.DEFAULT_LANE`). From the outside, the transcript moves
|
||||
by one screen, also when it is the selection that moves.
|
||||
"""
|
||||
from .tui.fkeys import FPair, default_lane
|
||||
|
||||
lane = list(default_lane(nav=bool(self._messages)))
|
||||
live = bool(self._messages)
|
||||
# The messages are in time order. Thus there are two days exactly when the two ends
|
||||
# have different dates. This costs O(1). A walk through the dividers dates the full
|
||||
# transcript again at each paint.
|
||||
days = live and (
|
||||
self._messages[0].created_at.astimezone().date()
|
||||
!= self._messages[-1].created_at.astimezone().date()
|
||||
)
|
||||
if self._locator is not None:
|
||||
lane[0] = FPair(
|
||||
"Day ↑",
|
||||
"ctrl_pageup",
|
||||
"Map",
|
||||
"locate",
|
||||
enabled=days,
|
||||
opp_enabled=self._locate_target() is not None,
|
||||
)
|
||||
else:
|
||||
lane[0] = FPair("Day ↑", "ctrl_pageup", enabled=days)
|
||||
lane[1] = FPair(
|
||||
"Day ↓",
|
||||
"ctrl_pagedown",
|
||||
"QR",
|
||||
"url_code",
|
||||
enabled=days,
|
||||
opp_enabled=bool(self._picked_urls()),
|
||||
)
|
||||
lane[3] = FPair("Page ↓", "pagedown", "Latest", "ctrl_end", enabled=live, opp_enabled=live)
|
||||
lane[4] = FPair("Page ↑", "pageup", "Oldest", "ctrl_home", enabled=live, opp_enabled=live)
|
||||
if not self._is_channel:
|
||||
retry = ("Retry", "retry")
|
||||
again = ("Retry", "retry")
|
||||
elif self._resend_unscoped is not None:
|
||||
retry = ("Resend", "retry")
|
||||
again = ("Resend", "retry")
|
||||
else:
|
||||
retry = ("", "")
|
||||
lane[2] = FPair(
|
||||
again = ("", "")
|
||||
lane[0] = FPair(
|
||||
"Paths",
|
||||
"paths",
|
||||
*retry,
|
||||
*again,
|
||||
enabled=self._selected is not None and self._paths is not None,
|
||||
opp_enabled=self._retry_target() is not None,
|
||||
)
|
||||
lane[1] = FPair("QR", "url_code", enabled=bool(self._picked_urls()))
|
||||
if self._locator is not None:
|
||||
lane[2] = FPair("Map", "locate", enabled=self._locate_target() is not None)
|
||||
lane[3] = FPair("Page ↓", "pagedown", "Latest", "ctrl_end", enabled=live, opp_enabled=live)
|
||||
lane[4] = FPair("Page ↑", "pageup", "Oldest", "ctrl_home", enabled=live, opp_enabled=live)
|
||||
return lane
|
||||
|
||||
def __init__(
|
||||
|
||||
+9
-14
@@ -105,24 +105,19 @@ class RoomScreen(ChatScreen):
|
||||
|
||||
@property
|
||||
def picocalc_lyra_lane(self):
|
||||
"""The lane of the chat, with *Log in* on the Shift half of F1 (F6), where ^O has no key.
|
||||
"""The lane of the chat, with *Log in* on the Shift half of F2 (F7), where ^O has no key.
|
||||
|
||||
Each chord that the desktop has needs a chip on the handheld. The chat puts
|
||||
``Map`` (^L) on the Shift half of F1, its one free slot. A room needs ``Log in``
|
||||
more, because a room takes no posts from a user who did not log in. Thus, in a
|
||||
room, ``Map`` has no chip. The chip is dim while a login is in progress.
|
||||
Each chord that the desktop has needs a chip on the handheld. The plain bank of F1
|
||||
to F3 has the verbs that a room shares with a channel and a DM, and the Shift bank
|
||||
has the verbs of the screen (refer to :attr:`ChatScreen.picocalc_lyra_lane`). Thus
|
||||
``Retry`` (^R) stays on the Shift half of F1, as in a DM, and ``Log in`` is next to
|
||||
it. The chip is dim while a login is in progress.
|
||||
"""
|
||||
from .tui.fkeys import FPair
|
||||
from dataclasses import replace
|
||||
|
||||
lane = list(super().picocalc_lyra_lane)
|
||||
day = lane[0]
|
||||
lane[0] = FPair(
|
||||
day.label,
|
||||
day.action,
|
||||
"Log in",
|
||||
"login",
|
||||
enabled=day.enabled,
|
||||
opp_enabled=not self._login_open,
|
||||
lane[1] = replace(
|
||||
lane[1], opp_label="Log in", opp_action="login", opp_enabled=not self._login_open
|
||||
)
|
||||
return lane
|
||||
|
||||
|
||||
+74
-44
@@ -1108,14 +1108,14 @@ async def test_chat_fkey_lane_dims_retry_and_the_nav_slots() -> None:
|
||||
failed = ChatMessage(text="oops", outbound=True, peer="d4e5f6a7", acked=False)
|
||||
screen = _screen(_StubSession(), send=None, messages=[failed], resend=resend)
|
||||
assert all(pair.enabled for pair in screen.picocalc_lyra_lane[3:]) # the pager moves the pick
|
||||
assert screen.picocalc_lyra_lane[2].opp_enabled is True # F8 Retry: the message has no ack
|
||||
assert screen.picocalc_lyra_lane[0].opp_enabled is True # F6 Retry: the message has no ack
|
||||
|
||||
screen.handle("retry")
|
||||
await asyncio.sleep(0)
|
||||
assert failed.acked is True
|
||||
assert screen.picocalc_lyra_lane[2].opp_enabled is False # acknowledged: nothing to retry
|
||||
assert screen.picocalc_lyra_lane[0].opp_enabled is False # acknowledged: nothing to retry
|
||||
assert (
|
||||
screen.picocalc_lyra_lane[2].opp_label == "Retry"
|
||||
screen.picocalc_lyra_lane[0].opp_label == "Retry"
|
||||
) # dim, not removed: it is part of this screen
|
||||
|
||||
|
||||
@@ -1130,7 +1130,7 @@ def test_chat_fkey_lane_speaks_the_transcript_and_drops_channel_retry() -> None:
|
||||
assert [pair.opp_label for pair in direct.picocalc_lyra_lane[3:]] == ["Latest", "Oldest"]
|
||||
assert [pair.opp_action for pair in direct.picocalc_lyra_lane[3:]] == ["ctrl_end", "ctrl_home"]
|
||||
assert [pair.label for pair in direct.picocalc_lyra_lane[3:]] == ["Page ↓", "Page ↑"]
|
||||
assert direct.picocalc_lyra_lane[2].opp_label == "Retry"
|
||||
assert direct.picocalc_lyra_lane[0].opp_label == "Retry"
|
||||
|
||||
channel = ChatScreen(
|
||||
Conversation(label="#general", is_channel=True, channel_id="1"),
|
||||
@@ -1141,8 +1141,8 @@ def test_chat_fkey_lane_speaks_the_transcript_and_drops_channel_retry() -> None:
|
||||
)
|
||||
# A channel message has no acknowledgement, so a retry is not possible here. The slot is
|
||||
# empty (it is not dim), and its key resolves to nothing.
|
||||
assert channel.picocalc_lyra_lane[2].opp_label == ""
|
||||
assert fkeys.PICOCALC_LYRA_DECK.action_for(channel.picocalc_lyra_lane, 8) is None
|
||||
assert channel.picocalc_lyra_lane[0].opp_label == ""
|
||||
assert fkeys.PICOCALC_LYRA_DECK.action_for(channel.picocalc_lyra_lane, 6) is None
|
||||
|
||||
|
||||
def test_chat_screen_up_picks_and_ctrl_end_returns_to_compose() -> None:
|
||||
@@ -1375,7 +1375,7 @@ async def test_chat_paths_key_needs_a_picked_message() -> None:
|
||||
await asyncio.sleep(0)
|
||||
assert shown == []
|
||||
assert "^P" not in screen.footer_hint
|
||||
assert screen.picocalc_lyra_lane[2].enabled is False
|
||||
assert screen.picocalc_lyra_lane[0].enabled is False
|
||||
|
||||
screen.handle("up")
|
||||
screen.handle("up") # select the older message
|
||||
@@ -1386,7 +1386,7 @@ async def test_chat_paths_key_needs_a_picked_message() -> None:
|
||||
# direct chat has no reply to prepare. (The hint of a channel keeps the ^P atom beside
|
||||
# its Enter reply.)
|
||||
assert "Enter paths" in screen.footer_hint
|
||||
assert screen.picocalc_lyra_lane[2].enabled is True
|
||||
assert screen.picocalc_lyra_lane[0].enabled is True
|
||||
|
||||
|
||||
async def test_chat_direct_enter_on_a_pick_opens_paths() -> None:
|
||||
@@ -2355,29 +2355,16 @@ async def test_channel_slot_change_drops_the_cached_channel_list(repo: Repositor
|
||||
await device.disconnect()
|
||||
|
||||
|
||||
def test_chat_fkey_lane_steps_by_day_on_the_free_left_pair() -> None:
|
||||
"""The sections of the transcript are days, so F1 and F2 name the section step ``Day``.
|
||||
def test_chat_fkey_lane_has_no_day_jump() -> None:
|
||||
"""No chip sends the day jump: JP removed ``Day ↑`` and ``Day ↓`` (2026-10-10).
|
||||
|
||||
The keys and the actions are the same as ``Sect ↑`` and ``Sect ↓`` of a grouped select
|
||||
list. The lane names what the sections are here. The chips are lit only if there is
|
||||
more than one day to step between, as a list with one section has no section jump.
|
||||
The desktop keeps the jump on ^PgUp and ^PgDn.
|
||||
"""
|
||||
from datetime import timedelta
|
||||
|
||||
from meshterm.core.models import utcnow
|
||||
|
||||
now = utcnow()
|
||||
one_day = [ChatMessage(text="hi", peer="d4e5f6a7", created_at=now)]
|
||||
single = _screen(_StubSession(), send=None, messages=one_day)
|
||||
assert [pair.label for pair in single.picocalc_lyra_lane[:2]] == ["Day ↑", "Day ↓"]
|
||||
assert [pair.action for pair in single.picocalc_lyra_lane[:2]] == [
|
||||
"ctrl_pageup",
|
||||
"ctrl_pagedown",
|
||||
]
|
||||
assert not any(
|
||||
pair.enabled for pair in single.picocalc_lyra_lane[:2]
|
||||
) # one day: no place to step to
|
||||
|
||||
spread = _screen(
|
||||
_StubSession(),
|
||||
send=None,
|
||||
@@ -2386,12 +2373,57 @@ def test_chat_fkey_lane_steps_by_day_on_the_free_left_pair() -> None:
|
||||
ChatMessage(text="now", peer="d4e5f6a7", created_at=now),
|
||||
],
|
||||
)
|
||||
assert all(pair.enabled for pair in spread.picocalc_lyra_lane[:2])
|
||||
# A left-hand pair rises toward F1, so a step back through the transcript is the outer
|
||||
# key. This is the same direction as the pager on the right.
|
||||
assert fkeys.PICOCALC_LYRA_DECK.action_for(spread.picocalc_lyra_lane, 1) == "ctrl_pageup"
|
||||
spread.handle(fkeys.PICOCALC_LYRA_DECK.action_for(spread.picocalc_lyra_lane, 1))
|
||||
assert spread._selected == 0 # moved to the first message of the older day
|
||||
lane = spread.picocalc_lyra_lane
|
||||
actions = {action for pair in lane if pair for action in (pair.action, pair.opp_action)}
|
||||
assert not actions & {"ctrl_pageup", "ctrl_pagedown"}
|
||||
deck = fkeys.PICOCALC_LYRA_DECK
|
||||
assert "Day" not in deck.lane_text(lane).plain + deck.lane_text(lane, shifted=True).plain
|
||||
|
||||
spread.handle("ctrl_pageup")
|
||||
assert spread._selected == 0 # the key still moves to the first message of the older day
|
||||
|
||||
|
||||
def test_channel_and_dm_lanes_share_f1_to_f3_and_keep_their_own_verbs_behind_shift() -> None:
|
||||
"""The plain bank of F1 to F3 is the same in each conversation (JP, 2026-10-10).
|
||||
|
||||
The verbs that the screens share are there, in the order of the hint. The Shift bank
|
||||
has the verbs of one screen: ``Retry`` in a DM and ``Resend`` in a channel, both ^R.
|
||||
"""
|
||||
from tests.conftest import recording_locator
|
||||
|
||||
messages = [ChatMessage(text="hi", peer="d4e5f6a7")]
|
||||
direct = ChatScreen(
|
||||
Conversation(
|
||||
label="Alice",
|
||||
is_channel=False,
|
||||
contact=Contact(name="Alice", public_key="d4" + "0" * 62, key_prefix="d4e5f6a7"),
|
||||
),
|
||||
messages,
|
||||
send=None,
|
||||
names={},
|
||||
session=_StubSession(),
|
||||
locator=recording_locator([]), # type: ignore[arg-type]
|
||||
)
|
||||
|
||||
async def resend_unscoped(message: ChatMessage) -> ChatMessage:
|
||||
return message
|
||||
|
||||
channel = ChatScreen(
|
||||
Conversation(label="#general", is_channel=True, channel_id="1"),
|
||||
[ChatMessage(text="Bob: hi", is_channel=True, channel_idx=0)],
|
||||
send=None,
|
||||
names={},
|
||||
session=_StubSession(),
|
||||
resend_unscoped=resend_unscoped,
|
||||
locator=recording_locator([]), # type: ignore[arg-type]
|
||||
)
|
||||
for screen in (direct, channel):
|
||||
lane = screen.picocalc_lyra_lane
|
||||
assert [pair.label for pair in lane[:3]] == ["Paths", "QR", "Map"]
|
||||
assert [pair.action for pair in lane[:3]] == ["paths", "url_code", "locate"]
|
||||
assert direct.picocalc_lyra_lane[0].opp_label == "Retry"
|
||||
assert channel.picocalc_lyra_lane[0].opp_label == "Resend"
|
||||
assert channel.picocalc_lyra_lane[0].opp_action == direct.picocalc_lyra_lane[0].opp_action
|
||||
|
||||
|
||||
# -- URL codes (the PicoCalc) ---------------------------------------------------
|
||||
@@ -2579,10 +2611,8 @@ def test_ctrl_u_is_named_only_on_a_picked_message_with_a_link() -> None:
|
||||
linked.handle("up")
|
||||
plain.handle("up")
|
||||
assert "^U QR" in linked.footer_hint and "^U" not in plain.footer_hint
|
||||
assert (
|
||||
fkeys.PICOCALC_LYRA_DECK.action_for(linked.picocalc_lyra_lane, 7) == "url_code"
|
||||
) # Shift+F2
|
||||
assert linked.picocalc_lyra_lane[1].opp_enabled and not plain.picocalc_lyra_lane[1].opp_enabled
|
||||
assert fkeys.PICOCALC_LYRA_DECK.action_for(linked.picocalc_lyra_lane, 2) == "url_code" # F2
|
||||
assert linked.picocalc_lyra_lane[1].enabled and not plain.picocalc_lyra_lane[1].enabled
|
||||
|
||||
# The hint of each selection state, with a link in it, fits in the 72-cell budget.
|
||||
direct = _screen(
|
||||
@@ -2615,7 +2645,7 @@ def test_on_the_cardputer_a_link_takes_the_share_screen_as_on_the_desktop() -> N
|
||||
screen = _url_chat(f"the road list is at {url}")
|
||||
assert not _code_rows(_strip_ansi(screen._render_grouped(53)).splitlines())
|
||||
screen.handle("up")
|
||||
assert fkeys.CARDPUTER_ZERO_DECK.action_for(screen.cardputer_zero_lane, 17) == "url_code"
|
||||
assert fkeys.CARDPUTER_ZERO_DECK.action_for(screen.cardputer_zero_lane, 5) == "url_code"
|
||||
|
||||
share = QrScreen(url, title="Links")
|
||||
share.note_viewport(14)
|
||||
@@ -2830,13 +2860,13 @@ async def test_chat_locate_opens_the_map_on_the_author_of_the_selected_message()
|
||||
locator=locator, # type: ignore[arg-type]
|
||||
)
|
||||
# With no selected message, ^L does nothing. The hint does not name it, and its chip on
|
||||
# the Shift half of F1 is dim.
|
||||
# F3 is dim.
|
||||
screen.handle("locate")
|
||||
await asyncio.sleep(0)
|
||||
assert locator.shown == []
|
||||
assert "^L" not in screen.footer_hint
|
||||
assert screen.picocalc_lyra_lane[0].opp_label == "Map"
|
||||
assert screen.picocalc_lyra_lane[0].opp_enabled is False
|
||||
assert screen.picocalc_lyra_lane[2].label == "Map"
|
||||
assert screen.picocalc_lyra_lane[2].enabled is False
|
||||
|
||||
# Our own message: its author is our node.
|
||||
screen.handle("up")
|
||||
@@ -2848,25 +2878,25 @@ async def test_chat_locate_opens_the_map_on_the_author_of_the_selected_message()
|
||||
# Bob has a key but no location, so there is nothing to show.
|
||||
screen.handle("up")
|
||||
assert "^L" not in screen.footer_hint
|
||||
assert screen.picocalc_lyra_lane[0].opp_enabled is False
|
||||
assert screen.picocalc_lyra_lane[2].enabled is False
|
||||
screen.handle("locate")
|
||||
await asyncio.sleep(0)
|
||||
assert locator.shown == [_US_AT]
|
||||
|
||||
# Alice has a location. The chip is lit, and F6 sends the same action as ^L.
|
||||
# Alice has a location. The chip is lit, and F3 sends the same action as ^L.
|
||||
screen.handle("up")
|
||||
assert "^L map" in screen.footer_hint
|
||||
assert screen.picocalc_lyra_lane[0].opp_enabled is True
|
||||
assert fkeys.PICOCALC_LYRA_DECK.action_for(screen.picocalc_lyra_lane, 6) == "locate"
|
||||
assert screen.picocalc_lyra_lane[2].enabled is True
|
||||
assert fkeys.PICOCALC_LYRA_DECK.action_for(screen.picocalc_lyra_lane, 3) == "locate"
|
||||
screen.handle("locate")
|
||||
await asyncio.sleep(0)
|
||||
assert locator.shown == [_US_AT, _ALICE_AT]
|
||||
|
||||
|
||||
def test_chat_without_a_locator_has_no_map_chip() -> None:
|
||||
"""A chat that cannot locate leaves the Shift half of F1 empty, not dim."""
|
||||
"""A chat that cannot locate leaves F3 empty, not dim."""
|
||||
screen = _screen(_StubSession(), send=None, messages=[ChatMessage(text="hi", peer="d4e5f6a7")])
|
||||
assert screen.picocalc_lyra_lane[0].opp_label == ""
|
||||
assert screen.picocalc_lyra_lane[2] is None
|
||||
|
||||
|
||||
def test_chat_hint_with_all_its_keys_fits_in_72_cells() -> None:
|
||||
|
||||
+13
-6
@@ -886,12 +886,18 @@ def test_the_hint_names_log_in_and_fits() -> None:
|
||||
assert cell_len(screen.footer_hint) <= 72
|
||||
|
||||
|
||||
def test_the_handheld_lane_puts_log_in_behind_f1() -> None:
|
||||
"""Each chord has a chip where the keyboard has no Ctrl key to reach it."""
|
||||
def test_the_handheld_lane_puts_log_in_behind_f2() -> None:
|
||||
"""Each chord has a chip where the keyboard has no Ctrl key to reach it.
|
||||
|
||||
Log in is a verb of the room only, so it is in the Shift bank, next to Retry.
|
||||
"""
|
||||
screen, _ = _view(_board())
|
||||
lane = screen.picocalc_lyra_lane
|
||||
assert lane[0].opp_label == "Log in"
|
||||
assert fkeys.PICOCALC_LYRA_DECK.action_for(lane, 6) == "login"
|
||||
assert lane[1].opp_label == "Log in"
|
||||
assert fkeys.PICOCALC_LYRA_DECK.action_for(lane, 7) == "login"
|
||||
assert lane[0].opp_label == "Retry"
|
||||
# The plain bank of F1 to F3 is the one of each conversation (refer to test_chat).
|
||||
assert [pair.label for pair in lane[:2]] == ["Paths", "QR"]
|
||||
|
||||
|
||||
async def test_l_opens_the_map_on_the_author_of_a_post() -> None:
|
||||
@@ -914,8 +920,9 @@ async def test_l_opens_the_map_on_the_author_of_a_post() -> None:
|
||||
screen.handle("locate")
|
||||
await asyncio.sleep(0)
|
||||
assert locator.shown == [alice]
|
||||
# The room keeps Log in on the Shift half of F1. Thus Map has no chip here.
|
||||
assert screen.picocalc_lyra_lane[0].opp_label == "Log in"
|
||||
# Map is on F3, as in each conversation, and Log in is on the Shift half of F2.
|
||||
assert screen.picocalc_lyra_lane[2].label == "Map"
|
||||
assert screen.picocalc_lyra_lane[1].opp_label == "Log in"
|
||||
|
||||
|
||||
# --- joining: the explained flow ------------------------------------------------------
|
||||
|
||||
@@ -426,7 +426,7 @@ async def test_resend_unscoped_targets_only_a_newest_scoped_message() -> None:
|
||||
assert screen._retry_target() is scoped
|
||||
assert "^R resend unscoped" in screen.footer_hint
|
||||
lane = screen.picocalc_lyra_lane
|
||||
assert lane[2].opp_label == "Resend" and lane[2].opp_enabled
|
||||
assert lane[0].opp_label == "Resend" and lane[0].opp_enabled # Shift+F1, the ^R of each chat
|
||||
|
||||
screen.handle("retry")
|
||||
await asyncio.sleep(0.05)
|
||||
@@ -498,7 +498,7 @@ def test_a_channel_with_nothing_to_resend_dims_the_chip() -> None:
|
||||
|
||||
screen = _channel_chat(_Session(), [unscoped], resend=resend)
|
||||
lane = screen.picocalc_lyra_lane
|
||||
assert lane[2].opp_label == "Resend" and not lane[2].opp_enabled
|
||||
assert lane[0].opp_label == "Resend" and not lane[0].opp_enabled
|
||||
assert fkeys.PICOCALC_LYRA_DECK.lane_text(lane, shifted=True).plain
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user