mod(app): automatically hide cursor when running fullscreen tui's
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 37s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 37s
This commit is contained in:
@@ -89,6 +89,7 @@ pub fn App(comptime E: type, comptime R: fn (comptime bool) type, comptime fulls
|
||||
if (fullscreen) {
|
||||
try terminal.saveScreen();
|
||||
try terminal.enterAltScreen();
|
||||
try terminal.hideCursor();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +110,7 @@ pub fn App(comptime E: type, comptime R: fn (comptime bool) type, comptime fulls
|
||||
if (this.termios) |*termios| {
|
||||
try terminal.disableRawMode(termios);
|
||||
if (fullscreen) {
|
||||
try terminal.showCursor();
|
||||
try terminal.existAltScreen();
|
||||
try terminal.restoreScreen();
|
||||
}
|
||||
|
||||
@@ -43,6 +43,14 @@ pub fn clearScreen() !void {
|
||||
_ = try std.posix.write(std.posix.STDIN_FILENO, "\x1b[2J");
|
||||
}
|
||||
|
||||
pub fn hideCursor() !void {
|
||||
_ = try std.posix.write(std.posix.STDIN_FILENO, "\x1b[?25l");
|
||||
}
|
||||
|
||||
pub fn showCursor() !void {
|
||||
_ = try std.posix.write(std.posix.STDIN_FILENO, "\x1b[?25h");
|
||||
}
|
||||
|
||||
pub fn setCursorPositionHome() !void {
|
||||
_ = try std.posix.write(std.posix.STDIN_FILENO, "\x1b[H");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user