So that we don't get garbled output in the case of a crash.
This is done using a custom struct that calls terminal cleanup functions on drop, similar to scopeguard, but it ensures that the panic hook (i.e. printing the error message) is done after the cleanup, so that the error message is not lost in the alternate screen.
So that we don't get garbled output in the case of a crash.
This is done using a custom struct that calls terminal cleanup functions on drop, similar to
scopeguard
, but it ensures that the panic hook (i.e. printing the error message) is done after the cleanup, so that the error message is not lost in the alternate screen.