Replace vaxis with zterm #1
10
src/app.zig
10
src/app.zig
@@ -79,11 +79,12 @@ pub fn App(comptime E: type, comptime R: fn (comptime bool) type, comptime fulls
|
|||||||
|
|
||||||
this.quit_event.reset();
|
this.quit_event.reset();
|
||||||
this.thread = try std.Thread.spawn(.{}, @This().run, .{this});
|
this.thread = try std.Thread.spawn(.{}, @This().run, .{this});
|
||||||
if (this.termios) |_| return;
|
|
||||||
|
|
||||||
var termios: std.posix.termios = undefined;
|
var termios: std.posix.termios = undefined;
|
||||||
try terminal.enableRawMode(&termios);
|
try terminal.enableRawMode(&termios);
|
||||||
this.termios = termios;
|
if (this.termios) |_| {} else {
|
||||||
|
this.termios = termios;
|
||||||
|
}
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
try terminal.saveScreen();
|
try terminal.saveScreen();
|
||||||
try terminal.enterAltScreen();
|
try terminal.enterAltScreen();
|
||||||
@@ -92,6 +93,10 @@ pub fn App(comptime E: type, comptime R: fn (comptime bool) type, comptime fulls
|
|||||||
|
|
||||||
pub fn interrupt(this: *@This()) !void {
|
pub fn interrupt(this: *@This()) !void {
|
||||||
this.quit_event.set();
|
this.quit_event.set();
|
||||||
|
if (fullscreen) {
|
||||||
|
try terminal.existAltScreen();
|
||||||
|
try terminal.restoreScreen();
|
||||||
|
}
|
||||||
if (this.thread) |thread| {
|
if (this.thread) |thread| {
|
||||||
thread.join();
|
thread.join();
|
||||||
this.thread = null;
|
this.thread = null;
|
||||||
@@ -107,6 +112,7 @@ pub fn App(comptime E: type, comptime R: fn (comptime bool) type, comptime fulls
|
|||||||
try terminal.restoreScreen();
|
try terminal.restoreScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.termios = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Quit the application loop.
|
/// Quit the application loop.
|
||||||
|
|||||||
Reference in New Issue
Block a user