mirror of
https://github.com/gitui-org/gitui.git
synced 2026-10-12 02:14:16 +00:00
Show cursor on panic (#2620)
ratatui::Terminal starts by hiding the cursor. If we panic and abort, that Terminal instance is not dropped, which leaves restoring the cursor state to us. Co-authored-by: Naseschwarz <[email protected]>
This commit is contained in:
co-authored by
Naseschwarz
parent
782ec070b4
commit
9056e5e75c
+7
-1
@@ -288,8 +288,10 @@ fn setup_terminal() -> Result<()> {
|
||||
}
|
||||
|
||||
fn shutdown_terminal() {
|
||||
let mut stdout = io::stdout();
|
||||
|
||||
let leave_screen =
|
||||
io::stdout().execute(LeaveAlternateScreen).map(|_f| ());
|
||||
stdout.execute(LeaveAlternateScreen).map(|_f| ());
|
||||
|
||||
if let Err(e) = leave_screen {
|
||||
eprintln!("leave_screen failed:\n{e}");
|
||||
@@ -300,6 +302,10 @@ fn shutdown_terminal() {
|
||||
if let Err(e) = leave_raw_mode {
|
||||
eprintln!("leave_raw_mode failed:\n{e}");
|
||||
}
|
||||
|
||||
if let Err(e) = stdout.execute(crossterm::cursor::Show) {
|
||||
eprintln!("Showing cursor failed:\n{e}");
|
||||
}
|
||||
}
|
||||
|
||||
fn draw(terminal: &mut Terminal, app: &App) -> io::Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user