mgunyho / tere

Terminal file explorer
European Union Public License 1.2
1.67k stars 36 forks source link

Reset terminal state in case of a panic #84

Closed mgunyho closed 1 year ago

mgunyho commented 1 year ago

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.