fix(terminal): restore screen correctly with alt screen
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m3s

This commit is contained in:
2025-10-18 23:30:15 +02:00
parent 1f6bbcc45e
commit 547f553404

View File

@@ -73,8 +73,8 @@ pub fn App(comptime E: type) type {
try terminal.enableRawMode(&termios); try terminal.enableRawMode(&termios);
if (this.termios) |_| {} else this.termios = termios; if (this.termios) |_| {} else this.termios = termios;
try terminal.saveScreen();
try terminal.enterAltScreen(); try terminal.enterAltScreen();
try terminal.saveScreen();
try terminal.hideCursor(); try terminal.hideCursor();
try terminal.enableMouseSupport(); try terminal.enableMouseSupport();
} }
@@ -82,8 +82,8 @@ pub fn App(comptime E: type) type {
pub fn interrupt(this: *@This()) !void { pub fn interrupt(this: *@This()) !void {
this.quit_event.set(); this.quit_event.set();
try terminal.disableMouseSupport(); try terminal.disableMouseSupport();
try terminal.exitAltScreen();
try terminal.restoreScreen(); try terminal.restoreScreen();
try terminal.exitAltScreen();
if (this.thread) |thread| { if (this.thread) |thread| {
thread.join(); thread.join();
this.thread = null; this.thread = null;
@@ -95,9 +95,9 @@ pub fn App(comptime E: type) type {
if (this.termios) |*termios| { if (this.termios) |*termios| {
try terminal.disableMouseSupport(); try terminal.disableMouseSupport();
try terminal.showCursor(); try terminal.showCursor();
try terminal.exitAltScreen();
try terminal.disableRawMode(termios);
try terminal.restoreScreen(); try terminal.restoreScreen();
try terminal.disableRawMode(termios);
try terminal.exitAltScreen();
} }
this.termios = null; this.termios = null;
} }