diff options
| author | user <user@clank> | 2026-09-02 15:03:53 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-09-02 15:03:53 +0200 |
| commit | 1a3ba183ae8f2613cae847c8f6460782512acc40 (patch) | |
| tree | 68bdc1e82b25e40452e2400ddcfcd2e6dd05b36e /tests/test_session.py | |
| parent | Merge branch 'multiplayer': shared multi-client attach (diff) | |
| download | slosh-1a3ba183ae8f2613cae847c8f6460782512acc40.tar.gz slosh-1a3ba183ae8f2613cae847c8f6460782512acc40.tar.xz slosh-1a3ba183ae8f2613cae847c8f6460782512acc40.zip | |
multi-attach: say who else is watching, and where you are
A small tag in each client's own top-right corner when several
terminals share the session: the viewer count, and on a view that is
a crop being panned by somebody else's cursor, the crop's offset into
the shared screen ("2 clients +12+4") -- which is exactly the moment
a screen moving on its own needs explaining. Stamped per client after
projection, because every terminal has its own count of others and
its own offset; the shared status bar is composed once and can be
cropped out of a panned view anyway. attach_indicator false hides
it.
Diffstat (limited to '')
| -rw-r--r-- | tests/test_session.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/test_session.py b/tests/test_session.py index 5878945..4a5c7e7 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -208,9 +208,14 @@ def main(): # --- multiple attached clients share one session -------------------- pid3, fd3 = attach(name, cols=50, rows=12) - drain(fd3) + out3 = drain(fd3) tail = drain(fd2, idle=0.2, limit=2.0) check( + "both clients are told about each other", + b"2 clients" in tail and b"2 clients" in out3, + repr((tail[-80:], out3[-80:])), + ) + check( "a second client leaves the first attached", b"replaced" not in tail and running(pid2), repr(tail[-60:]), @@ -245,6 +250,17 @@ def main(): ) check("the last client to type owns the size", screen_size(name) == (80, 24)) + # Push the shared cursor below the small client's 12 rows: its view has + # to pan down to follow, and the tag must say where it went. + os.write(fd2, b"\n" * 20) + drain(fd2) + panned = drain(fd3) + check( + "a cropped view names its offset into the shared screen", + b"clients +" in panned, + repr(panned[-100:]), + ) + resize(pid3, fd3, 40, 10) drain(fd3) check( |
