On Fri, Oct 27, 2023 at 9:41 AM Zeke Williams <lakele...@gmail.com> wrote:
This is not a flaw of ed, because it doesn't use a means of terminal > control such as ncurses, which is what emacs and vim, and even the vim > implementation of ex use, it can only just print to stdout and be done > with it. I was considering using ANSI escape codes to make it possible > to have the prompt stay at the very bottom and the stdout printed > always above it, but I feel it might get too messy and ugly and hacky. > Not to mention, be less portable overall. > It's not that messy. By outputting the ANSI escape sequence "\x1B[A\r\x1B[J" before any other output is done, the newline typed at the end of the command can be effectively undone. This can be gated behind a command-line switch to prevent problems with excessively dumb terminals. It will not work correctly with non-ANSI terminals, but that hardly matters nowadays.