diff options
| author | user <user@clank> | 2026-08-17 14:13:44 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-17 14:13:44 +0200 |
| commit | e2eac8ef074d15cbff4844b956ddbe1031200dc8 (patch) | |
| tree | bb7eef6e3f543e38ced30675b350e22e50b03001 /src/app.c | |
| parent | sl0ppty: a wrapped line is one line when you copy it (diff) | |
| download | slosh-e2eac8ef074d15cbff4844b956ddbe1031200dc8.tar.gz slosh-e2eac8ef074d15cbff4844b956ddbe1031200dc8.tar.xz slosh-e2eac8ef074d15cbff4844b956ddbe1031200dc8.zip | |
sl0ppty: a dead pane says what it ran
```
│help: find a package to install `watch` with `cargo search cargo-watch` │
│ │
│[ran: cargo watch -x test] │
│[process exited: status 101] │
╰ exited: status 101 ─────────────────────────────────[re-run]─[close]─╯
```
`[re-run]` is one button on a pane whose program is gone, and nothing on the pane
said what it would run. The command was never anywhere: not in the frame, not in
the backlog, not in the exit note. Worst in a tab a project's layout built, where
the command was never typed into that pane and so cannot be scrolled back to
either -- which is now the common case, since that is what `open-workspace` does.
So the death note gains a line above it. A pane running the session's shell has no
command to name and gets the exit line alone, as before: `[ran: /bin/sh]` would be
noise dressed as information.
One note rather than two calls. `pane_note` puts a blank line either side of what
it writes, so two of them would space the two halves apart as if they were about
different things, when they are two facts about one run.
Re-running keeps the previous run above it (D14), so the pair turns a pane you
re-run into a log of what ran rather than a pile of identical epitaphs.
Not put in the frame footer, which is the other place the question gets asked. It
already carries the exit words and competes with the buttons for width, so a long
command would arrive truncated in the one place that is always visible -- and the
note is on screen anyway in the case that matters, because a pane whose program
just exited is scrolled to the bottom.
**Three existing tests were counting a string that now appears twice.** `DIES_CMD`
is `echo mark-one; exit 3`, and they waited for `screen().count("mark-one") == 2`
to mean "it ran twice" -- but the note contains the command, so every run now
matches twice and the wait never finished. They ask `output_runs()` instead, which
counts lines holding the marker that are not the `[ran:` line. Per line rather
than by trimming the text, because every row still has the pane's frame border on
the end of it. That is a fair correction and not a weakening: the assertion is
still "the output appeared twice", which is what they meant.
Verified: 56 checks in `tests/test_dead.py`, 1801 overall, all green. Three new:
the command is named and sits *above* the exit line (asserted by row order, not by
reading the two strings out of one screen); a pane with no command names none; and
two runs produce two of each note. Then a real session, `command="cargo watch -x
test"` with cargo-watch not installed, which is how this was noticed.
Diffstat (limited to 'src/app.c')
| -rw-r--r-- | src/app.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -1127,8 +1127,21 @@ bool app_pump_fd(app_t *a, int fd) { if (was_alive && !pane_alive(f.found->pane)) { char words[64]; exit_words(f.found->pane, words, sizeof words); - char note[96]; - snprintf(note, sizeof note, "[process %s]", words); + /* What it ran, above how it ended. `[re-run]` is one button on a pane whose + * program is gone, and a pane that does not say what it would run makes + * pressing it a guess -- especially in a tab somebody else's layout built, + * where the command was never typed here in the first place. A pane running + * the session's shell has no command to name and gets the exit line alone. + * + * One note rather than two: `pane_note` puts a blank line either side of + * what it writes, so two calls would space the two halves apart as if they + * were about different things. */ + const char *label = pane_label(f.found->pane); + char note[320]; + if (label && *label) + snprintf(note, sizeof note, "[ran: %s]\r\n[process %s]", label, words); + else + snprintf(note, sizeof note, "[process %s]", words); pane_note(f.found->pane, note, DEAD_C); } return true; |
