termio: clear screen always sends form feed (0x0C)

Fixes #555
This commit is contained in:
Mitchell Hashimoto
2023-09-29 21:42:58 -07:00
parent 3569073ff5
commit abc3838546

View File

@ -379,20 +379,12 @@ pub fn clearScreen(self: *Exec, history: bool) !void {
// Clear our scrollback // Clear our scrollback
if (history) try self.terminal.screen.clear(.history); if (history) try self.terminal.screen.clear(.history);
// If we're not at a prompt, we clear the screen manually using // Clear our screen using terminal state.
// the terminal screen state. If we are at a prompt, we send try self.terminal.screen.clear(.above_cursor);
// form-feed so that the shell can repaint the entire screen.
if (!self.terminal.cursorIsAtPrompt()) {
// Clear above the cursor
try self.terminal.screen.clear(.above_cursor);
// Exit
return;
}
} }
// If we reached here it means we're at a prompt, so we send a form-feed. // We also always send form feed so that the terminal can repaint
assert(self.terminal.cursorIsAtPrompt()); // our prompt.
try self.queueWrite(&[_]u8{0x0C}); try self.queueWrite(&[_]u8{0x0C});
} }