mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +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 <naseschwarz@0x53a.de>
This commit is contained in:
parent
782ec070b4
commit
9056e5e75c
1 changed files with 7 additions and 1 deletions
|
|
@ -288,8 +288,10 @@ fn setup_terminal() -> Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn shutdown_terminal() {
|
fn shutdown_terminal() {
|
||||||
|
let mut stdout = io::stdout();
|
||||||
|
|
||||||
let leave_screen =
|
let leave_screen =
|
||||||
io::stdout().execute(LeaveAlternateScreen).map(|_f| ());
|
stdout.execute(LeaveAlternateScreen).map(|_f| ());
|
||||||
|
|
||||||
if let Err(e) = leave_screen {
|
if let Err(e) = leave_screen {
|
||||||
eprintln!("leave_screen failed:\n{e}");
|
eprintln!("leave_screen failed:\n{e}");
|
||||||
|
|
@ -300,6 +302,10 @@ fn shutdown_terminal() {
|
||||||
if let Err(e) = leave_raw_mode {
|
if let Err(e) = leave_raw_mode {
|
||||||
eprintln!("leave_raw_mode failed:\n{e}");
|
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<()> {
|
fn draw(terminal: &mut Terminal, app: &App) -> io::Result<()> {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue