It is also possible to use the functions defined in REPL.Terminals
, instead of using the escape sequences directly (the functions just print the sequences anyway):
import REPL
terminal = REPL.Terminals.TTYTerminal(string(), stdin, stdout, stderr)
println() # Dummy line
for i in (1, "two", :III, "||||")
REPL.Terminals.cmove_left(terminal, length(string(i)))
REPL.Terminals.cmove_line_up(terminal)
println(i)
sleep(0.5)
end
println("Watch the final number dissapear above me")
sleep(0.5)
REPL.Terminals.cmove_line_up(terminal, 2)
REPL.Terminals.clear_line(terminal)
REPL.Terminals.cmove_line_down(terminal, 3) # If not, next input is above previous output, which looks funny
This was discovered as I was writing up Overwriting previous terminal output with built-in functions.