Of course some tool like acme would solve the problem, but it is a different approach.
For acme, the editor is a plain-text-only multiplexer (much easier to implement), and replaces every ncurses interfaces, so it is skipping the problem. For sam, the editor '!' command, pipes the output to a dedicated buffer, omly if it is too long, a bit like this in the end: > I've played around a tiny bit with dumping > everything that goes through st to a file [...] Nothing that can handle arbitrary placement of the cursor on the terminal grid, like "\033[3;6H", just plain text. But maybe a scrollback of just plain text (and text properties like "\033[<something>m") would be good enough. Only recording raw output from commands, logging it to a text file like the script(1) command and calling a pager on this file while asking for scrollback. I rarely want to get a scrollback of an ncurses program. Some of them sets an "alternate screen" signal cleaning the screen ("\033[?1049h") and restoring it afterward ("\033[?1049l") it ran. Stripping everything in-between would strip most ncurses programs out of the feed.