Closed henrik closed 5 years ago
This seems to work in my OS X terminal: http://stackoverflow.com/a/10995085/6962
PoC:
IO.puts "My progress:" IO.puts("\e[?25l") 1..100 |> Enum.each fn (i) -> IO.write "\r[#{String.duplicate "=", i}] #{i} %" :timer.sleep 25 end IO.puts "\nDone!" IO.puts("\e[?25h")
Consider that if someone ctrl+C:s before restoring the cursor, that terminal will be without one. Trap exits? Overkill?
Experimented a bit - ctrl+c might be untrappable.
Closing this since I don't think I'll get around to it, but if anyone else wants to, feel free!
This seems to work in my OS X terminal: http://stackoverflow.com/a/10995085/6962
PoC:
Consider that if someone ctrl+C:s before restoring the cursor, that terminal will be without one. Trap exits? Overkill?