Enter on the live feed's pin opens the packet viewer on the pin
The viewer now opens on the stop the feed has. On the pin (^), the card follows the stream and the feed stays pinned; on a selected packet, the viewer holds that packet as before. Enter no longer drops the pin. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c8f7e7ec48
commit
db62ddf701
4 files changed
+87
-27
No files matched your search
+26
-7
@@ -366,12 +366,30 @@ def test_livefeed_home_resumes_following_from_deep_in_the_history() -> None:
|
||||
assert screen._selected == 0 # the feed follows again, and does not stay on the old newest
|
||||
|
||||
|
||||
def test_livefeed_opening_a_packet_drops_the_pin() -> None:
|
||||
"""Enter names this packet, so an arrival during a long read cannot move the highlight."""
|
||||
def test_livefeed_opening_a_packet_keeps_the_pin() -> None:
|
||||
"""Enter on the pin opens the viewer on the pin, so the feed and the card both follow.
|
||||
|
||||
JP decided this on 2026-10-10. Before, Enter removed the pin.
|
||||
"""
|
||||
screen = _screen(seed=[_obs(node="n0", age_s=1)])
|
||||
screen.future = _Fut()
|
||||
assert screen._pinned
|
||||
screen._select_row(0) # this is what _open_packet does before it floats the viewer
|
||||
screen.handle("enter")
|
||||
viewer = screen._session.opened
|
||||
assert viewer is not None and viewer._pinned and "following" in viewer.title
|
||||
assert screen._pinned, "Enter knocked the feed out of the stream"
|
||||
|
||||
screen.on_event(MeshEvent.observation_event(_obs(node="a1b2")))
|
||||
assert screen._selected == 0, "the pin let go of the top"
|
||||
assert "Alice" in _plain(viewer.render_body(72)), "the card did not follow the stream"
|
||||
|
||||
|
||||
def test_livefeed_opening_a_selected_packet_holds_it() -> None:
|
||||
"""Enter on a selected packet holds it, so an arrival during a long read cannot move it."""
|
||||
screen = _screen(seed=[_obs(node="n0", age_s=1)])
|
||||
screen.handle("down") # off the pin, onto the newest packet
|
||||
screen.handle("enter")
|
||||
viewer = screen._session.opened
|
||||
assert viewer is not None and not viewer._pinned
|
||||
assert not screen._pinned and screen._selected == 0
|
||||
screen.on_event(MeshEvent.observation_event(_obs(node="a1b2")))
|
||||
assert screen._selected == 1, "the cursor left the packet being viewed"
|
||||
@@ -380,11 +398,12 @@ def test_livefeed_opening_a_packet_drops_the_pin() -> None:
|
||||
def test_livefeed_viewer_that_walks_up_to_the_stream_re_pins_the_feed() -> None:
|
||||
"""The viewer has the second stop of this screen, and it returns the pin through it.
|
||||
|
||||
Enter still names this packet, so the dialog opens with one packet. The user can press
|
||||
up at the top of the viewer. This is the same move as up at the top of the feed. Thus
|
||||
the feed follows the stream again, and it still follows when the dialog closes.
|
||||
Enter on a selected packet opens the dialog on that packet. The user can press up at
|
||||
the top of the viewer. This is the same move as up at the top of the feed. Thus the
|
||||
feed follows the stream again, and it still follows when the dialog closes.
|
||||
"""
|
||||
screen = _screen(seed=[_obs(node="n0", age_s=2), _obs(node="n1", age_s=1)])
|
||||
screen.handle("down") # off the pin, onto the newest packet
|
||||
screen.handle("enter")
|
||||
viewer = screen._session.opened
|
||||
assert viewer is not None and not screen._pinned
|
||||
|
||||
@@ -158,7 +158,7 @@ def test_packet_viewer_follows_the_stream_off_the_top_of_a_live_list() -> None:
|
||||
source=lambda: list(feed),
|
||||
on_pin=lambda: pinned_by_viewer.append(True),
|
||||
)
|
||||
assert not viewer._pinned, "opening a packet named that packet, not the stream"
|
||||
assert not viewer._pinned, "an open without pinned holds the packet, not the stream"
|
||||
assert "↑ follow" in viewer.footer_hint
|
||||
|
||||
viewer.handle("up")
|
||||
@@ -176,6 +176,35 @@ def test_packet_viewer_follows_the_stream_off_the_top_of_a_live_list() -> None:
|
||||
assert "1/2" in viewer.title # the viewer holds that packet, which now moves down the list
|
||||
|
||||
|
||||
def test_packet_viewer_opens_on_the_pin_of_a_live_list() -> None:
|
||||
"""``pinned`` opens on the pin: the card follows the stream from the first paint.
|
||||
|
||||
The open does not call ``on_pin``, because the list is already on its own pin. Over a
|
||||
snapshot, ``pinned`` does nothing, because there is no stream to follow.
|
||||
"""
|
||||
old = PacketEntry(when=utcnow(), kind="advert", node="aa")
|
||||
feed = [old]
|
||||
pinned_by_viewer = []
|
||||
viewer = PacketViewer(
|
||||
list(feed),
|
||||
0,
|
||||
pinned=True,
|
||||
resolve=lambda h: "",
|
||||
source=lambda: list(feed),
|
||||
on_pin=lambda: pinned_by_viewer.append(True),
|
||||
)
|
||||
assert viewer._pinned and viewer.title.endswith("· following")
|
||||
assert "↓ hold packet" in viewer.footer_hint
|
||||
assert pinned_by_viewer == []
|
||||
|
||||
newer = PacketEntry(when=utcnow(), kind="message", node="bb", text="new!")
|
||||
feed.insert(0, newer)
|
||||
assert "new!" in _plain(viewer.render_body(80))
|
||||
|
||||
snapshot = PacketViewer([newer, old], 0, pinned=True, resolve=lambda h: "")
|
||||
assert not snapshot._pinned and "following" not in snapshot.title
|
||||
|
||||
|
||||
def test_packet_viewer_over_a_snapshot_has_nothing_to_follow() -> None:
|
||||
"""With no live source there is no pin. ``↑`` at the newest packet clamps, as before."""
|
||||
newer = PacketEntry(when=utcnow(), kind="message", node="bb", text="new!")
|
||||
|
||||
Reference in new issue
Block a user