- Jun
- 1,092
- 48
I stumbled across this difference in the way ANSI sequences are processed by ECHO and ECHOERR. With ECHO I can write a line and then use ESC [ A to move the cursor up one line and overwrite the previous text. That does not work with ECHOERR.
If I use ECHOS and ECHOSERR and ^r to return to the beginning of the line, both work.
The equivalent ANSI sequence for "cursor to beginning of line" also works for both, so the problem is not with all ANSI sequences and seems to be only for ECHOERR, not ECHOSERR.
Code:
>echo. & do i = 1 to 5 (echo ^e[A %@format[3,%i] of 5 & delay 1 )
5 of 5
>echoerr. & do i = 1 to 5 (echoerr ^e[A %@format[3,%i] of 5 & delay 1 )
1 of 5
2 of 5
3 of 5
4 of 5
5 of 5
If I use ECHOS and ECHOSERR and ^r to return to the beginning of the line, both work.
Code:
>do i = 1 to 5 (echoserr ^r %@format[3,%i] of 5 & delay 1 )
5 of 5
>do i = 1 to 5 (echos ^r %@format[3,%i] of 5 & delay 1 )
5 of 5
The equivalent ANSI sequence for "cursor to beginning of line" also works for both, so the problem is not with all ANSI sequences and seems to be only for ECHOERR, not ECHOSERR.
Code:
>do i = 1 to 5 (echos ^e[G %@format[3,%i] of 5 & delay 1 )
5 of 5
>do i = 1 to 5 (echoserr ^e[G %@format[3,%i] of 5 & delay 1 )
5 of 5