Martin Guy wrote:
On 06/11/2023, Antonio Diaz Diaz<anto...@gnu.org> wrote:
Zeke Williams wrote:
Would there be any additional gotchas (Other than it won't work with
non-ANSI terminals) to using "\x1B[A\r\x1B[J" to work around so to
speak not using ncurses
So I guess the proposed "\x1B[A\r\x1B[J" may work for ed.
Is \r enough to obtain the effect? It would be a bit more... purist,
but I wouldn't encode ANSI escape sequences into ed if it can be avoided.
Sadly \r seems to be the only avoidable part of the sequence above (because
the cursor is already at the beginning of the line when the ANSI sequence
would be sent to the terminal).
The final part "\x1B[J" (erase up to the end of the page) or "\x1B[K" (erase
up to the end of the line) could also be avoided if we limit the sending of
the escape sequence to the null command without an address (i.e., a single
newline), because in this case the line above the cursor would be already blank.
In any case, even if this feature is implemented, it would be only activated
with a command-line option (preferably more informative than '--ex-emulation').
Best regards,
Antonio.