Hi, is there a way to erase a line from the REPL ?
I’m using ProgressMeter but I’d also like to occasionally print a line when an event occurs.
I made the following MWE. Basically, I’d like the “I reached…” statement to erase the progress line, and in subsequent iterations, the progress will appear at the last line.
julia> using ProgressMeter
julia> prog = ProgressUnknown()
ProgressUnknown(false, false, 0, ProgressMeter.ProgressCore(:green, "Progress: ", 0.1, true, 0, Base.TTY(Base.Libc.WindowsRawSocket(0x000000000000027c) open, 0 bytes waiting), false, 1, 0, ReentrantLock(nothing, 0x00000000, 0x00, Base.GenericCondition{Base.Threads.SpinLock}(Base.IntrusiveLinkedList{Task}(nothing, nothing), Base.Threads.SpinLock(0)), (8, 1, 142273203075)), 0, 1, false, Int64[], 1.709735239111e9, 1.709735239111e9, 1.709735239111e9))
julia> for i in 1:100
next!(prog)
sleep(0.1)
if i%25==0
println("I reached $i")
end
end
Progress: 25 Time: 0:01:16I reached 25
Progress: 50 Time: 0:01:18I reached 50
Progress: 75 Time: 0:01:21I reached 75
Progress: 100 Time: 0:01:24I reached 100
println(rpad("\rI reached $i",displaysize(stdout)[2]))
works a little better for the first line:
I reached 25
Progress: 50 Time: 0:00:06I reached 50
Progress: 75 Time: 0:00:09I reached 75
Progress: 100 Time: 0:00:12I reached 100
But it creates unwanted blank lines, in addition to not working for the other lines.