whatToRun(edited: { text: string; saved: boolean; aborted: boolean; }): string
What an edit leaves to run: the buffer where it moved, and nothing where it did not.
Quitting without writing means "never mind", and a scratchpad that runs what you just walked away from is one you stop using for anything you are not sure about. A buffer emptied and saved runs nothing either, for the same reason it would at the prompt.
What it reads is saved — whether a WRITE happened, off the file's mtime — not whether the text
came back different. Those are not the same question, and the difference was the bug.
import { whatToRun } from './editor.ts'; whatToRun({ text: '1 + 1', saved: true, aborted: false }); // '1 + 1' whatToRun({ text: '1 + 1', saved: false, aborted: false }); // '' — never written, never mind whatToRun({ text: '1 + 1', saved: true, aborted: true }); // '' — written, then `:cq`