diff options
| author | user <user@clank> | 2026-08-15 15:21:24 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-15 15:21:24 +0200 |
| commit | 8379c0e7e92eb31a351e5023a1364ec8e95b402c (patch) | |
| tree | 4e2628719f15123b93fe036fdf830e77d71c70d6 /tests/test_states.py | |
| parent | sl0ppty: dim the panes you are not in, and a knob to say how much (diff) | |
| download | slosh-8379c0e7e92eb31a351e5023a1364ec8e95b402c.tar.gz slosh-8379c0e7e92eb31a351e5023a1364ec8e95b402c.tar.xz slosh-8379c0e7e92eb31a351e5023a1364ec8e95b402c.zip | |
sl0ppty: only panes that were given a command keep their corpse
Keeping every dead pane was too much. Split off a shell, do something in it,
type `exit` -- and you are left with a corpse to dismiss, which is fussiness
rather than information. You know what happened. You did it.
So the policy has a line now, and the line is the *command*, not who made the
pane. A pane told to run `npm run dev` is part of the session's shape: when it
dies you want the error it left and the button that runs it again. A pane that
is a shell is finished when you say so.
Not provenance, because a shell is a shell whether a layout file made it or
C-a \ did -- and that also means a session restored from dump-layout behaves
like the one it was dumped from, since the dump writes `command=` only for
panes that had one. The distinguishing mark turned out to need no new state:
pane_label() already holds the command a layout gave it and is empty for a
plain shell, so this is a policy over something already recorded.
`keep_dead` is now `commands` (default), `all` or `none`, and still reads
`true`/`false` as `all`/`none` -- that was the shipped spelling and a config
saying it should keep working rather than quietly changing behaviour.
Most of the diff is tests. The dead-pane suite had been written against the
session's own pane, which is a shell under the new rule, so it was testing the
half of the policy that now says "reap it". They run commanded panes from
layouts instead, and the pair of cases -- a shell you split off goes, a
commanded pane stays -- sits together in one place so the rule is legible in
the test file too.
One of those layouts wanted an escape sequence, which has to be written `\\033`
so KDL's unescaping hands `\033` to the shell. Written singly the shell prints
`033[38;2;...` and the test reads as "the colour stopped working".
Diffstat (limited to 'tests/test_states.py')
| -rw-r--r-- | tests/test_states.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/test_states.py b/tests/test_states.py index 13776f7..fa1426e 100644 --- a/tests/test_states.py +++ b/tests/test_states.py @@ -44,11 +44,18 @@ def fg(snap, pane, row=0, col=0): def test_a_dead_pane_is_coloured_by_default(): - with Session(["/bin/sh", "-c", 'printf "\\033]2;p\\007"; echo DONE; exit 3'], - cols=50, rows=10, config=cfg()) as s: + # A *commanded* pane: only those keep their corpse by default, which is + # the only kind there is to colour. + lay = tempfile.NamedTemporaryFile("w", suffix=".kdl", delete=False) + lay.write('layout {\n tab {\n' + ' pane command="printf \'\\\\033]2;p\\\\007\'; echo DONE; exit 3"\n' + ' }\n}\n') + lay.close() + with Session(SH, cols=50, rows=10, config=cfg(), layout=lay.name) as s: snap = s.until_text("[process exited") check("its contents are not left looking live", fg(snap, s.pane()) not in (None, "#ffffff"), str(fg(snap, s.pane()))) + os.unlink(lay.name) def test_a_suspended_pane_is_coloured_by_default(): |
