^O opens the author's node page, and ^G logs in to a room

In a channel, a DM, or a room, ^O on a selected message opens the node page
of its author, the same page the Contacts list opens: our own for a message
of ours, the contact the author's key finds otherwise (ContactPages, the twin
of the map's Locator). It opens to look, without the management verbs, which
belong to the list a contact is in. The hint names ^O only where it acts; the
handheld chip is Author, on Shift+F3 behind Map, since F1-F3 are full.

The room's login moves from ^O to ^G.

The Unreleased changelog now also says where the Map chip went, and covers
the shared lane and the route-end chips.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Opus 5.5 committed 2026-10-11 00:25:35 -04:00
1 parent 00a7b82347
commit 2d2128718a
11 files changed
+430 -66

No files matched your search

+17 -4
View File
@@ -15,14 +15,27 @@ can change how things behave. It does not only add new things.
of a room, select a message and press ^L. The map opens on the node that wrote it. On
the Contacts page, ^L opens the map on the highlighted contact. The key works only when
MeshTerm knows where the node is, and the hint at the bottom of the screen names it only
then. On the handhelds, the chip is `Map`, on Shift+F1. The board of a room has no free
chip for it yet.
then. On the handhelds, the chip is `Map`, on F3.
- **^O opens the page of the node that wrote a message.** In a chat or on the board of a
room, select a message and press ^O. The node page opens, the same page that the
Contacts list opens. For a message of yours, the page of your own node opens. The key
works only when the author is one of your contacts. On the handhelds, the chip is
`Author`, on Shift+F3.
### Changed
- **^L is now the map key, and ^O logs in to a room.** On the map and in the mesh walk, ^L
goes back to your own node. That key was ^Y. On the board of a room, ^O logs in. That
- **^L is now the map key, and ^G logs in to a room.** On the map and in the mesh walk, ^L
goes back to your own node. That key was ^Y. On the board of a room, ^G logs in. That
key was ^L.
- **A channel, a direct chat, and a room have the same F-key chips.** On the handhelds,
F1, F2, and F3 are `Paths`, `URL→QR`, and `Map` on the three screens. With Shift, these
keys hold what only one screen has: `Retry` or `Resend`, and `Log in` on a room. The
`Day ↑` and `Day ↓` chips are gone. On the desktop, ^PgUp and ^PgDn still move from one
day to the next.
- **Chips show where a route starts and where it ends.** Where your terminal draws path
chips, the author of a message has a point on the right of its chip. A mention is a chip
with a notch on its left. The packet viewer, the live feed, the Messages list, and the
courier show the sender and the recipient in the same way.
## [0.10.3] - 2026-10-07
+8 -5
View File
@@ -280,9 +280,10 @@ deliberately, one at a time, and say why in the code.
- A row that opens further prompts ends with `…`; a row that acts immediately doesn't.
- **A bare-letter shortcut only where nothing is typed.** A screen that filters, finds or
composes as you type has no free letters, so its verbs are Ctrl chords — one table,
`session._CTRL_LETTER_CHORDS`, each letter the mnemonic of its action (`^P` paths,
`^U` URL, `^L` locate, `^O` log in). One verb per letter across screens is the preference,
not the rule (JP, 2026-10-10): a screen that has no use for a letter's verb may give the
`session._CTRL_LETTER_CHORDS`, each letter the mnemonic of its action where it can be
(`^P` paths, `^U` URL, `^L` locate, `^O` open the author's page; `^G` logs in to a room,
JP's pick, 2026-10-11). One verb per letter across screens is the preference, not the
rule (JP, 2026-10-10): a screen that has no use for a letter's verb may give the
letter a verb of its own, so long as nothing between the keyboard and the app takes it —
`^A`/`^B` are screen's and tmux's prefixes, and `^M`/`^I`/`^H`/`^J` *are* Enter, Tab,
Backspace and LF. A screen that takes no typing may spend a bare letter instead (the
@@ -778,9 +779,11 @@ branch on the platform per frame, and never `from meshterm.platforms import PLAT
- **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), `URL→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)
Shift+F1 (`Retry` in a DM and a room, `Resend` in a channel), the room's `Log in` (^G)
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.
one of them goes on the Shift bank; one all three gain goes on the plain bank — and once
that is full, on Shift+F3: `Author` (^O, the author's node page, `ContactPages`) rides
there behind `Map`, its twin about the same author.
- **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
+101 -21
View File
@@ -50,6 +50,7 @@ if TYPE_CHECKING:
from ..context import AppContext
from .map_render import MapMarker
from .map_screen import Locator
from .node_detail_screen import ContactPages
#: The delivery marks for a *resolved* outbound direct message, at the end of its line:
@@ -132,21 +133,26 @@ class ChatScreen(Screen):
"""The PicoCalc lane of a conversation: the same lane in a channel, a DM, and a room.
The plain bank of F1 to F3 has the verbs that all three screens share, in the order
of the hint: ``Paths`` (^P), ``URL→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
of the hint: ``Paths`` (^P), ``URL→QR`` (^U), and ``Map`` (^L). The Shift bank of F1
and F2 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`` (^G) 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 three shared verbs act *on* the selected message. ``Paths`` is lit while a
message is selected. ``URL→QR`` shows the codes of the links of the selection on a
share screen, one code at a time with its full URL, and is lit while the selection
has a URL (refer to :meth:`_picked_urls`). On the Cardputer it is the only way to a
code. On the PicoCalc, the transcript already draws each code under its message in
the same size, so there the chip only shows one code alone. ``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.
The shared verbs act *on* the selected message. ``Paths`` is lit while a message is
selected. ``URL→QR`` shows the codes of the links of the selection on a share
screen, one code at a time with its full URL, and is lit while the selection has a
URL (refer to :meth:`_picked_urls`). On the Cardputer it is the only way to a code.
On the PicoCalc, the transcript already draws each code under its message in the
same size, so there the chip only shows one code alone. ``Map`` is lit while the
author of the selection has a location (refer to :meth:`_locate_target`).
``Author`` (^O, the node page of the author of the selection) is the fourth shared
verb, and the plain bank has only three slots. Thus it is on the Shift half of F3,
behind ``Map``, the other verb about the author. It is lit while the author has a
page (refer to :meth:`_author_page`). Each of the two halves of F3 is empty when
the screen has nothing to find that node with.
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
@@ -188,8 +194,15 @@ class ChatScreen(Screen):
opp_enabled=self._retry_target() is not None,
)
lane[1] = FPair("URL→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)
if self._locator is not None or self._pages is not None:
where = ("Map", "locate") if self._locator is not None else ("", "")
who = ("Author", "author_page") if self._pages is not None else ("", "")
lane[2] = FPair(
*where,
*who,
enabled=self._locate_target() is not None,
opp_enabled=self._author_page() 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
@@ -208,6 +221,7 @@ class ChatScreen(Screen):
scope: str | None = None,
resend_unscoped: Callable[[ChatMessage], Awaitable[ChatMessage | None]] | None = None,
locator: Locator | None = None,
pages: ContactPages | None = None,
) -> None:
"""Build the chat screen.
@@ -242,6 +256,9 @@ class ChatScreen(Screen):
locator: The located nodes, for ^L: the map on the author of the selected
message (refer to :class:`~meshterm.ui.map_screen.Locator`). With ``None``,
^L does nothing.
pages: The contacts, for ^O: the node page of the author of the selected
message (refer to :class:`~meshterm.ui.node_detail_screen.ContactPages`).
With ``None``, ^O does nothing.
"""
super().__init__()
self._scope = scope if conversation.is_channel else None
@@ -270,6 +287,7 @@ class ChatScreen(Screen):
self._resend_unscoped = resend_unscoped if conversation.is_channel else None
self._paths = paths
self._locator = locator
self._pages = pages
self._names = names
self._session = session
self._editor = LineEditor()
@@ -283,6 +301,7 @@ class ChatScreen(Screen):
self._stick = True # keep the newest message visible until the user scrolls up
self._paths_open = False # one paths dialog at a time
self._map_open = False # one map at a time
self._page_open = False # one node page at a time
self._codes_open = False # one share screen of links at a time
self._paste_open = False # one paste-confirm dialog at a time
self._resend_open = False # one resend-unscoped confirm at a time
@@ -320,44 +339,60 @@ class ChatScreen(Screen):
Only the keys that do something show. ``^P paths`` must have a selected message to
show the paths *of*. ``^U QR`` must have a selected message with a URL in it
(refer to :meth:`_picked_urls`). ``^L map`` must have a selected message whose
author has a location (refer to :meth:`_locate_target`). ``^R retry failed`` must
have something to retry (refer to :meth:`_retry_target`). The F-key lane uses the
same rules to dim its slots.
author has a location (refer to :meth:`_locate_target`). ``^O author`` must have a
selected message whose author has a node page (refer to :meth:`_author_page`).
``^R retry failed`` must have something to retry (refer to :meth:`_retry_target`).
The F-key lane uses the same rules to dim its slots.
"""
if self._selected is not None:
code = "^U QR" if self._picked_urls() else ""
where = "^L map" if self._locate_target() is not None else ""
who = "^O author" if self._author_page() is not None else ""
if self._is_channel and self._retry_target() is not None:
# A selected scoped message of ours can be sent again unscoped, and the hint
# must name that key. The "(@mention)" of the reply and ^End are removed to
# keep the line inside 72 cells (Esc still cancels the selection, and Enter
# still says what it does). If the line is still too long, ↑↓ goes first,
# then ^P, which the hint of each other selected message names.
# then ^P, which the hint of each other selected message names, then ^O.
# The message is ours here, so ^O only opens our own page.
return _fit_hint(
[
"Enter reply",
"^P paths",
code,
where,
who,
"^R resend unscoped",
"↑↓ pick",
"Esc cancel",
],
spare=("↑↓ pick", "^P paths"),
spare=("↑↓ pick", "^P paths", "^O author"),
)
if self._replies:
return _fit_hint(
# With all the keys of a selection, the long words do not fit in 72 cells.
# Then the hint uses the short words of the resend hint above.
hint = _fit_hint(
[
"Enter reply (@mention)",
"^P paths",
code,
where,
who,
"↑↓ pick",
"^End/Esc cancel",
],
spare=("↑↓ pick",),
)
return _fit_hint(["Enter paths", code, where, "↑↓ pick", "^End/Esc cancel"])
if cell_len(hint) <= _HINT_CELLS:
return hint
return _fit_hint(
["Enter reply", "^P paths", code, where, who, "↑↓ pick", "Esc cancel"],
spare=("↑↓ pick",),
)
return _fit_hint(
["Enter paths", code, where, who, "↑↓ pick", "^End/Esc cancel"],
spare=("↑↓ pick",),
)
if self._retry_target() is not None:
if self._is_channel:
return "Enter send · ↑ pick a message · ^R resend unscoped · Esc back"
@@ -858,6 +893,8 @@ class ChatScreen(Screen):
self._open_codes()
elif action == "locate":
self._open_map()
elif action == "author_page":
self._open_author_page()
elif action == "retry":
if self._is_channel:
self._begin_resend_unscoped()
@@ -955,6 +992,47 @@ class ChatScreen(Screen):
self._session.run_detached(run())
def _author_page(self) -> Callable[[], Awaitable[None]] | None:
"""The node page that ^O opens for the selected message, or ``None`` when there is none.
The page belongs to the author of the message: our node for a message of ours, or
the contact that the key of the author finds (refer to :meth:`_header_key`, the
same key that gives the colour of the sender chip). A message with no sender, or an
author that is not a contact, has no page. The hint and the F-key lane ask this at
each paint, so that they name ^O only when it acts.
"""
pages = self._pages
if pages is None or self._selected is None or not self._messages:
return None
message = self._messages[max(0, min(self._selected, len(self._messages) - 1))]
if message.outbound:
return lambda: pages.show(None)
sender, _body = self._sender_and_body(message)
if sender == "·":
return None
contact = pages.find(self._header_key(sender, message))
return None if contact is None else (lambda: pages.show(contact))
def _open_author_page(self) -> None:
"""Open the node page of the author of the selected message (^O). One page at a time.
The page is a screen, and it goes on the stack above the chat. Esc on the page comes
back to the chat, with the same message selected.
"""
page = self._author_page()
if page is None or self._page_open:
return
self._page_open = True
async def run() -> None:
try:
await page()
finally:
self._page_open = False
self._session.invalidate()
self._session.run_detached(run())
def _picked_urls(self) -> list[str]:
"""The URLs in the body of the selected message, in order. None if nothing is selected."""
if self._selected is None or not self._messages:
@@ -1422,6 +1500,7 @@ async def open_chat(ctx: AppContext, conversation: Conversation) -> int:
)
from .map_screen import Locator
from .node_detail_screen import ContactPages
paths = await _make_paths_presenter(ctx, conversation, device)
screen = ChatScreen(
@@ -1436,6 +1515,7 @@ async def open_chat(ctx: AppContext, conversation: Conversation) -> int:
scope=scope,
resend_unscoped=resend_unscoped,
locator=await Locator.gather(ctx),
pages=await ContactPages.gather(ctx),
)
ctx.chat.set_active(conversation.key)
+68
View File
@@ -1242,6 +1242,74 @@ def _located(lat: float | None, lon: float | None) -> bool:
# -- data gathering + the action loop -----------------------------------------
class ContactPages:
"""The contacts whose node page a screen can open, and the page that opens on one of them.
This is the ^O key (``author_page``) of a conversation: the page of the node that wrote
the selected message. At each paint, the screen asks :meth:`find` for the contact of
the author. Thus its hint and its F-key lane name ^O only when the key acts. Then
:meth:`show` opens the page that the Contacts list opens for that contact. It is the
twin of :class:`~meshterm.ui.map_screen.Locator`, which ^L uses for the map.
The contacts come from the device one time, when the screen opens.
"""
def __init__(self, ctx: AppContext, contacts: list[Contact]) -> None:
"""Hold the contacts that :meth:`find` searches.
Args:
ctx: The shared application context (it must be in the interactive menu).
contacts: The contacts of the device.
"""
self._ctx = ctx
self._contacts = contacts
# The result of each key that find() got. A screen asks at each paint, and the
# answer for one key does not change while the contacts stay the same.
self._found: dict[str, Contact | None] = {}
@classmethod
async def gather(cls, ctx: AppContext) -> ContactPages:
"""The pages of the contacts that the device has now. With no contacts, nothing is found."""
try:
contacts = await ctx.devstate.contacts()
except Exception: # noqa: BLE001 - with no contacts, ^O opens only our own page
contacts = []
return cls(ctx, list(contacts))
def find(self, key: str | None) -> Contact | None:
"""The contact with ``key`` (a full key or a key prefix), or ``None``.
The rule is the same as the rule of the map (refer to
:meth:`~meshterm.ui.map_screen.Locator.find`). A key prefix finds the contact whose
full key starts with it, and a full key finds a contact that MeshTerm knows only by
its key prefix.
"""
if not key:
return None
needle = key.lower().removeprefix("0x")
if needle not in self._found:
self._found[needle] = next(
(c for c in self._contacts if _same_key(c.public_key or c.key_prefix, needle)),
None,
)
return self._found[needle]
async def show(self, contact: Contact | None) -> None:
"""Open the node page of ``contact``, or of our node when it is ``None``.
The page opens to look, not to manage (``manage=False``). The management verbs
(lock, archive, restore, delete) belong to the list that the contact is in, and a
conversation is not that list.
"""
await open_node_detail(self._ctx, contact, manage=False)
def _same_key(contact_key: str | None, needle: str) -> bool:
"""Whether the key of a contact and a lowercase key (or key prefix) name the same node."""
key = (contact_key or "").lower().removeprefix("0x")
return bool(key) and (key.startswith(needle) or needle.startswith(key))
async def open_node_detail(
ctx: AppContext, contact: Contact | None, *, manage: bool = True
) -> bool:
+25 -18
View File
@@ -22,7 +22,7 @@ Three things make it different, and each one belongs to the room:
(:mod:`meshterm.ui.rooms`). Here, when the user opens a joined room, MeshTerm logs in to
it again only if the room has been quiet
(:meth:`~meshterm.services.rooms.RoomService.login_due`). It does this quietly, and the
board is open to read. ^O runs the explained login when the user wants it.
board is open to read. ^G runs the explained login when the user wants it.
* **Posting waits for the room.** A room drops, with no message, a post from anyone that it
does not know, or that it knows at the read-only access. Thus the compose line opens only
when we are logged in and can post. Until then, it says why it is not open and which key
@@ -52,6 +52,7 @@ from .chat import ChatScreen, _belongs, _contact_names, _make_paths_presenter, _
if TYPE_CHECKING:
from ..context import AppContext
from .map_screen import Locator
from .node_detail_screen import ContactPages
#: The title's login atom while a login is in flight.
LOGGING_IN = "logging in…"
@@ -96,16 +97,17 @@ class RoomScreen(ChatScreen):
It does everything that a chat does. When the user selects a post, Enter replies with an
``@mention``. ^P shows the paths that a post took. ^L opens the map on the author of a
post. ^R tries again a post that the room did not acknowledge. It also has ^O, which
logs in to the room. It uses the remembered password, or it asks for a password when
none is remembered or when the last login got no answer.
post, and ^O opens the node page of that author. ^R tries again a post that the room did
not acknowledge. It also has ^G, which logs in to the room. It uses the remembered
password, or it asks for a password when none is remembered or when the last login got
no answer.
"""
_empty_text = "No posts yet"
@property
def picocalc_lyra_lane(self):
"""The lane of the chat, with *Log in* on the Shift half of F2 (F7), where ^O has no key.
"""The lane of the chat, with *Log in* on the Shift half of F2 (F7), where ^G has no key.
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
@@ -138,6 +140,7 @@ class RoomScreen(ChatScreen):
paths: Callable[[ChatMessage], Awaitable[None]] | None = None,
key_of: Callable[[str], str | None] | None = None,
locator: Locator | None = None,
pages: ContactPages | None = None,
) -> None:
"""Build the room screen.
@@ -165,6 +168,7 @@ class RoomScreen(ChatScreen):
paths: Shows the paths that a selected post took (^P).
key_of: Gives the key of its node for a name, for the hues of ``@mention``.
locator: The located nodes, for ^L: the map on the author of a post.
pages: The contacts, for ^O: the node page of the author of a post.
"""
super().__init__(
conversation,
@@ -176,6 +180,7 @@ class RoomScreen(ChatScreen):
paths=paths,
key_of=key_of,
locator=locator,
pages=pages,
)
self._label = conversation.label
self._resolve = resolve
@@ -191,7 +196,7 @@ class RoomScreen(ChatScreen):
# --- the login ----------------------------------------------------------------------
def begin_login(self, *, ask: bool = False) -> None:
"""^O: the explained login flow, with its prompt and its result floating over the board.
"""^G: the explained login flow, with its prompt and its result floating over the board.
Args:
ask: Ask for the password also when one is remembered. A member at the read-only
@@ -209,7 +214,7 @@ class RoomScreen(ChatScreen):
title says ``logging in…`` while the login runs, and the compose line waits for the
answer. A room that has forgotten us drops each post that we send. Thus the compose
line opens only when the room has let us in. If the room does not answer, this shows
in the same two places, and ^O is the explained retry.
in the same two places, and ^G is the explained retry.
"""
if self._login_open:
return
@@ -305,16 +310,16 @@ class RoomScreen(ChatScreen):
# Each reason is inside the 53 columns of the handhelds, so it is one line everywhere.
why = {
LOGGING_IN: "logging in… posting opens once the room lets you in",
NO_REPLY: "not logged in: no answer from the room · ^O to retry",
REFUSED: "not logged in: the login was refused · ^O to retry",
FAILED: "not logged in · ^O to try again",
NOT_JOINED: "not joined · ^O to join",
NO_REPLY: "not logged in: no answer from the room · ^G to retry",
REFUSED: "not logged in: the login was refused · ^G to retry",
FAILED: "not logged in · ^G to try again",
NOT_JOINED: "not joined · ^G to join",
}.get(self._login_state or "")
if why is None:
why = (
"read-only — the room drops your posts · ^O to log in"
"read-only — the room drops your posts · ^G to log in"
if self._access is RoomAccess.READ_ONLY
else "not logged in · ^O to log in"
else "not logged in · ^G to log in"
)
return Text(why, style="muted")
@@ -324,10 +329,10 @@ class RoomScreen(ChatScreen):
super()._submit()
def handle(self, action: str, data: str = "") -> None:
"""^O logs in. The chat handles all the other actions."""
"""^G logs in. The chat handles all the other actions."""
if action == "login":
# The remembered password of a member at the read-only access gave all that it
# can, so ^O asks for another password. For each other member, the flow tries
# can, so ^G asks for another password. For each other member, the flow tries
# the remembered password first and asks only if it fails.
self.begin_login(ask=self._access is RoomAccess.READ_ONLY)
self._session.invalidate()
@@ -343,7 +348,7 @@ class RoomScreen(ChatScreen):
@property
def footer_hint(self) -> str:
"""The hint of the chat, in the words of a board, with ^O when a login can start.
"""The hint of the chat, in the words of a board, with ^G when a login can start.
A selected post has the hint of a selected message in the chat. With no place for a
reply, Enter shows the paths of the post there too.
@@ -355,7 +360,7 @@ class RoomScreen(ChatScreen):
if self._retry_target() is not None:
atoms.append("^R retry failed")
if not self._login_open:
atoms.append("^O log in")
atoms.append("^G log in")
atoms.append("Esc back")
return " · ".join(atoms)
@@ -368,7 +373,7 @@ async def open_room(ctx: AppContext, conversation: Conversation) -> int:
board is readable. The login starts the catch-up of the room again. A room that MeshTerm
heard from recently sends nothing. The Rooms page joins a room
(:mod:`meshterm.ui.rooms`). Thus a room that is not joined opens only to read its
stored posts, and ^O joins it. Posts that arrive while the board is open are added at
stored posts, and ^G joins it. Posts that arrive while the board is open are added at
once, and the unread count of the room stays clear while the user is on the board.
Args:
@@ -380,6 +385,7 @@ async def open_room(ctx: AppContext, conversation: Conversation) -> int:
"""
from ..services import trace_runner
from .map_screen import Locator
from .node_detail_screen import ContactPages
from .rooms import join_room
session = ctx.ui.session
@@ -434,6 +440,7 @@ async def open_room(ctx: AppContext, conversation: Conversation) -> int:
paths=await _make_paths_presenter(ctx, conversation, device),
key_of=trace_runner.make_name_key_resolver(contacts, stored_names),
locator=await Locator.gather(ctx),
pages=ContactPages(ctx, list(contacts)),
)
ctx.chat.set_active(conversation.key)
+1 -1
View File
@@ -19,7 +19,7 @@ password worked before. The page then offers the next step as buttons: try by fl
first forgets the stale route), try again, or try another password. Each of these is one
more login that the user asked for. MeshTerm never sends one on its own.
This flow (:func:`join_room`) is shared. The ^O key of the board also runs it. The
This flow (:func:`join_room`) is shared. The ^G key of the board also runs it. The
``rooms join`` command of the command line explains a silent room in the same words
(:func:`silence_explanation`).
+14 -8
View File
@@ -78,11 +78,13 @@ from .spinner import spinner_interval
#: The letter of a chord is the mnemonic of the action, not of the word that one screen uses
#: for it. ``locate`` is ^L: on the map and in the mesh walk it goes to our node, and in the
#: chat and on Contacts it opens the map on the node of the selected row. It was ^U until
#: 2026-10-01, then ^Y until 2026-10-10, when ``login`` moved from ^L to ^O (JP). One action
#: for each letter in all screens is the preference, not the rule (JP, 2026-10-10). A screen
#: that has no use for the action of a letter can give the letter a different action, if no
#: terminal or multiplexer takes it. ^A and ^B are not free for this reason: they are the
#: prefix keys of GNU screen and tmux.
#: 2026-10-01, then ^Y until 2026-10-10, when ``login`` moved from ^L to ^O (JP). On
#: 2026-10-11, ``login`` moved again to ^G, and ^O became ``author_page``: the node page of
#: the author of the selected message, the same as ^L opens the map on that author (JP).
#: One action for each letter in all screens is the preference, not the rule (JP,
#: 2026-10-10). A screen that has no use for the action of a letter can give the letter a
#: different action, if no terminal or multiplexer takes it. ^A and ^B are not free for
#: this reason: they are the prefix keys of GNU screen and tmux.
#:
#: Two of these chords are for the full app, not for one screen:
#:
@@ -100,10 +102,14 @@ from .spinner import spinner_interval
#: ``IXON``/``IXOFF``, so ^Q is not XON here.
_CTRL_LETTER_CHORDS: dict[str, str] = {
"c": "quit",
# ^G logs in to the room that a room screen shows. In the input, ^G is not a special key:
# it is the bell only in output, and no terminal or multiplexer takes it.
"g": "login",
"l": "locate",
# ^O logs in to the room that a room screen shows. The raw mode of prompt_toolkit clears
# IEXTEN, so a terminal on macOS or BSD does not take ^O to discard output.
"o": "login",
# ^O opens the node page of the author of the selected message. The raw mode of
# prompt_toolkit clears IEXTEN, so a terminal on macOS or BSD does not take ^O to
# discard output.
"o": "author_page",
"p": "paths",
"q": "quit",
"r": "retry",
+17
View File
@@ -69,6 +69,23 @@ def recording_locator(markers: list) -> object:
return locator
def recording_pages(contacts: list) -> object:
"""A real :class:`~meshterm.ui.node_detail_screen.ContactPages` whose pages are a list.
It finds contacts with the rule of the app. Instead of a node page, :meth:`show` appends
the contact that the page would open on to ``shown`` (``None`` is our node).
"""
from meshterm.ui.node_detail_screen import ContactPages
class _Recording(ContactPages):
async def show(self, contact) -> None: # noqa: ANN001 - a Contact, or None for us
self.shown.append(contact)
pages = _Recording(None, contacts) # type: ignore[arg-type]
pages.shown = [] # type: ignore[attr-defined]
return pages
#: The root of the checkout.
_ROOT = Path(__file__).resolve().parent.parent
+138
View File
@@ -2899,6 +2899,83 @@ def test_chat_without_a_locator_has_no_map_chip() -> None:
assert screen.picocalc_lyra_lane[2] is None
async def test_chat_author_page_opens_the_node_page_of_the_author_of_the_selection() -> None:
"""^O opens the node page of the author of the selected message, named only where it acts.
It is the twin of ^L: the same author, found by the same key. Its chip is ``Author``,
on the Shift half of F3, behind ``Map``.
"""
from tests.conftest import recording_pages
alice = Contact(name="Alice", public_key="a1" * 32, key_prefix="a1" * 6)
pages = recording_pages([alice])
keys = {"alice": "a1" * 32, "bob": "b2" * 32}
screen = ChatScreen(
Conversation(label="#public", is_channel=True, channel_idx=0),
[
ChatMessage(text="Alice: hi", is_channel=True, channel_idx=0),
ChatMessage(text="Bob: yo", is_channel=True, channel_idx=0),
ChatMessage(text="hello", outbound=True, is_channel=True, channel_idx=0),
],
send=None,
names={},
session=_StubSession(),
key_of=lambda name: keys.get(name.casefold()),
pages=pages, # type: ignore[arg-type]
)
# With no selected message, ^O does nothing. The hint does not name it, and its chip is
# dim. The screen has no locator, so the plain half of F3 is empty.
screen.handle("author_page")
await asyncio.sleep(0)
assert pages.shown == []
assert "^O" not in screen.footer_hint
lane = screen.picocalc_lyra_lane
assert (lane[2].label, lane[2].opp_label) == ("", "Author")
assert lane[2].opp_enabled is False
# Our own message: its author is our node, whose page has no contact.
screen.handle("up")
assert "^O author" in screen.footer_hint
screen.handle("author_page")
await asyncio.sleep(0)
assert pages.shown == [None]
# Bob has a key but he is not a contact, so there is no page to open.
screen.handle("up")
assert "^O" not in screen.footer_hint
assert screen.picocalc_lyra_lane[2].opp_enabled is False
screen.handle("author_page")
await asyncio.sleep(0)
assert pages.shown == [None]
# Alice is a contact. The chip is lit, and Shift+F3 sends the same action as ^O.
screen.handle("up")
assert "^O author" in screen.footer_hint
assert screen.picocalc_lyra_lane[2].opp_enabled is True
assert fkeys.PICOCALC_LYRA_DECK.action_for(screen.picocalc_lyra_lane, 8) == "author_page"
screen.handle("author_page")
await asyncio.sleep(0)
assert pages.shown == [None, alice]
def test_a_direct_chat_finds_the_page_of_its_peer() -> None:
"""In a DM, the author of an inbound message is the peer, and the peer is a contact."""
from tests.conftest import recording_pages
peer = Contact(name="Alice", public_key="d4" + "0" * 62, key_prefix="d4e5f6a7")
screen = ChatScreen(
Conversation(label="Alice", is_channel=False, contact=peer),
[ChatMessage(text="hi", peer="d4e5f6a7")],
send=None,
names={"d4e5f6a7": "Alice"},
session=_StubSession(),
pages=recording_pages([peer]), # type: ignore[arg-type]
)
screen.handle("up")
assert "^O author" in screen.footer_hint
assert cell_len(screen.footer_hint) <= 72
def test_chat_hint_with_all_its_keys_fits_in_72_cells() -> None:
"""The longest hint (a scoped message of ours, with a link, on the map) fits in 72 cells.
@@ -2934,3 +3011,64 @@ def test_chat_hint_with_all_its_keys_fits_in_72_cells() -> None:
for atom in ("Enter reply", "^U QR", "^L map", "^R resend unscoped", "Esc cancel"):
assert atom in hint
assert "↑↓ pick" not in hint and "^P paths" not in hint
def test_chat_resend_hint_drops_our_own_page_third() -> None:
"""With ^O too, the resend hint drops ↑↓, then ^P, then ^O: the message is ours."""
async def resend_unscoped(message: ChatMessage) -> ChatMessage | None:
return None
from tests.conftest import recording_locator, recording_pages
screen = ChatScreen(
Conversation(label="#ops", is_channel=True, channel_idx=1),
[
ChatMessage(
text="map at https://meshterm.net",
outbound=True,
is_channel=True,
channel_idx=1,
scope="yul",
)
],
send=None,
names={},
session=_StubSession(),
scope="yul",
resend_unscoped=resend_unscoped,
locator=recording_locator([_US_AT]), # type: ignore[arg-type]
pages=recording_pages([]), # type: ignore[arg-type]
)
screen.handle("up")
hint = screen.footer_hint
assert cell_len(hint) <= 72
for atom in ("Enter reply", "^U QR", "^L map", "^R resend unscoped", "Esc cancel"):
assert atom in hint
assert "↑↓ pick" not in hint and "^P paths" not in hint and "^O" not in hint
def test_chat_reply_hint_with_every_key_of_a_selection_fits_in_72_cells() -> None:
"""A message of a located contact, with a link: the reply hint takes its short words.
With ^U, ^L, and ^O, the long words (``(@mention)``, ``^End/Esc``) do not fit. The
short words of the resend hint do, and then each key of the selection stays.
"""
from tests.conftest import recording_locator, recording_pages
alice = Contact(name="Alice", public_key="a1" * 32, key_prefix="a1" * 6)
screen = ChatScreen(
Conversation(label="#public", is_channel=True, channel_idx=0),
[ChatMessage(text="Alice: map at https://meshterm.net", is_channel=True, channel_idx=0)],
send=None,
names={},
session=_StubSession(),
key_of=lambda name: "a1" * 32 if name.casefold() == "alice" else None,
locator=recording_locator([_ALICE_AT]), # type: ignore[arg-type]
pages=recording_pages([alice]), # type: ignore[arg-type]
)
screen.handle("up")
hint = screen.footer_hint
assert cell_len(hint) <= 72
for atom in ("Enter reply", "^P paths", "^U QR", "^L map", "^O author", "Esc cancel"):
assert atom in hint
+2 -2
View File
@@ -540,7 +540,7 @@ def _room(cols: int, rows: int, *, access=None, retry: bool = False) -> Screen:
The board has a post by a contact (with a name, in its hue), a post by an author that
nothing names (the grey hash), a notice that the room posted itself, and our own post.
If ``retry`` is set, our post has no ack, so ^R joins ^O on the hint. This is the longest
If ``retry`` is set, our post has no ack, so ^R joins ^G on the hint. This is the longest
that the hint gets.
"""
from meshterm.core.models import LoginResult, RoomAccess, RoomLogin
@@ -676,7 +676,7 @@ def _room_read_only(cols: int, rows: int) -> Screen:
def _room_retry(cols: int, rows: int) -> Screen:
"""A post of ours with no ack: ^R retry joins ^O on the hint."""
"""A post of ours with no ack: ^R retry joins ^G on the hint."""
return _room(cols, rows, retry=True)
+39 -7
View File
@@ -697,6 +697,7 @@ def _view(
joined: bool = True,
login: RoomLogin | None = None,
locator: object = None,
pages: object = None,
) -> tuple[RoomScreen, dict]:
"""A board with stub hooks. ``calls`` records the requests to the hooks."""
calls: dict = {"auto": 0, "joins": [], "sent": []}
@@ -728,6 +729,7 @@ def _view(
joined=joined,
access=access,
locator=locator, # type: ignore[arg-type]
pages=pages, # type: ignore[arg-type]
)
return screen, calls
@@ -808,7 +810,7 @@ async def test_after_silence_nothing_can_be_posted_and_the_line_says_why() -> No
screen.begin_auto_login()
await _settled(screen)
assert screen.title.endswith(NO_REPLY)
assert "no answer" in _compose(screen) and "^O" in _compose(screen)
assert "no answer" in _compose(screen) and "^G" in _compose(screen)
for ch in "hi":
screen.handle("text", ch)
screen.handle("enter")
@@ -818,18 +820,18 @@ async def test_after_silence_nothing_can_be_posted_and_the_line_says_why() -> No
async def test_control_l_runs_the_explained_login() -> None:
"""^O gives the login to the Rooms flow, with its dialogs over the board, and shows the end."""
"""^G gives the login to the Rooms flow, with its dialogs over the board, and shows the end."""
screen, calls = _view(access=None, login=RoomLogin(LoginResult.ACCEPTED, RoomAccess.ADMIN))
screen.handle("login")
assert screen._login_open
assert "^O log in" not in screen.footer_hint # a second press does nothing
assert "^G log in" not in screen.footer_hint # a second press does nothing
await _settled(screen)
assert calls["joins"] == [False]
assert screen.title == f"{ROOM.name} · admin" and screen._composing
async def test_a_read_only_member_is_asked_for_another_password_and_offered_no_retry() -> None:
"""^O asks, because the room password lets a read-only member post. ^R is only dropped."""
"""^G asks, because the room password lets a read-only member post. ^R is only dropped."""
unacked = ChatMessage(text="lost", outbound=True, peer=ROOM.key_prefix, acked=False)
screen, calls = _view([unacked], access=RoomAccess.READ_ONLY)
assert "read-only" in _compose(screen)
@@ -878,9 +880,9 @@ async def test_a_read_only_member_picks_a_post_to_see_its_paths_not_to_reply() -
def test_the_hint_names_log_in_and_fits() -> None:
"""The hint names ^O where it acts, in 72 cells, with or without a selected post."""
"""The hint names ^G where it acts, in 72 cells, with or without a selected post."""
screen, _ = _view(_board())
assert "^O log in" in screen.footer_hint
assert "^G log in" in screen.footer_hint
assert cell_len(screen.footer_hint) <= 72
screen.handle("up")
assert cell_len(screen.footer_hint) <= 72
@@ -900,8 +902,38 @@ def test_the_handheld_lane_puts_log_in_behind_f2() -> None:
assert [pair.label for pair in lane[:2]] == ["Paths", "URL→QR"]
async def test_o_opens_the_node_page_of_the_author_of_a_post() -> None:
"""^O opens the page of the contact that signed the selected post, by its key prefix."""
from tests.conftest import recording_pages
alice = Contact(name="Alice", public_key=ALICE_KEY + "0" * 56, key_prefix=ALICE_KEY + "0000")
pages = recording_pages([alice])
screen, _ = _view(_board(), pages=pages)
for _ in range(4):
screen.handle("up") # the oldest post, by Alice
assert "^O author" in screen.footer_hint
screen.handle("author_page")
await asyncio.sleep(0)
assert pages.shown == [alice]
# No contact has the key of the stranger, so ^O does nothing, and the hint does not name it.
screen.handle("down")
assert "^O" not in screen.footer_hint
screen.handle("author_page")
await asyncio.sleep(0)
assert pages.shown == [alice]
assert screen.picocalc_lyra_lane[2].opp_label == "Author"
def test_the_login_key_is_g_and_o_opens_the_author_page() -> None:
"""^G logs in to a room, and ^O opens the page of the author of a message (JP, 2026-10-11)."""
from meshterm.ui.tui.session import _CTRL_LETTER_CHORDS
assert _CTRL_LETTER_CHORDS["g"] == "login"
assert _CTRL_LETTER_CHORDS["o"] == "author_page"
async def test_l_opens_the_map_on_the_author_of_a_post() -> None:
"""^L opens the map on the author of the selected post. ^O keeps the login."""
"""^L opens the map on the author of the selected post. ^G keeps the login."""
from meshterm.core.models import MapMarker
from tests.conftest import recording_locator