mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
implement ESC c
-- full reset
This commit is contained in:
@ -1322,6 +1322,20 @@ pub fn setScrollingRegion(self: *Terminal, top: usize, bottom: usize) void {
|
||||
self.setCursorPos(1, 1);
|
||||
}
|
||||
|
||||
/// Full reset
|
||||
pub fn fullReset(self: *Terminal) void {
|
||||
self.primaryScreen(.{});
|
||||
self.selection = null;
|
||||
self.charset = .{};
|
||||
self.eraseDisplay(.scrollback);
|
||||
self.eraseDisplay(.complete);
|
||||
self.modes = .{};
|
||||
self.tabstops.reset(0);
|
||||
self.screen.cursor = .{};
|
||||
self.screen.saved_cursor = .{};
|
||||
self.scrolling_region = .{ .top = 0, .bottom = self.rows - 1 };
|
||||
}
|
||||
|
||||
test "Terminal: input with no control characters" {
|
||||
var t = try init(testing.allocator, 80, 80);
|
||||
defer t.deinit(testing.allocator);
|
||||
|
@ -567,6 +567,15 @@ pub fn Stream(comptime Handler: type) type {
|
||||
},
|
||||
} else log.warn("unimplemented invokeCharset: {}", .{action}),
|
||||
|
||||
// RIS - Full Reset
|
||||
'c' => if (@hasDecl(T, "fullReset")) switch (action.intermediates.len) {
|
||||
0 => try self.handler.fullReset(),
|
||||
else => {
|
||||
log.warn("invalid full reset command: {}", .{action});
|
||||
return;
|
||||
},
|
||||
} else log.warn("unimplemented ESC callback: {}", .{action}),
|
||||
|
||||
// LS2 - Locking Shift 2
|
||||
'n' => if (@hasDecl(T, "invokeCharset")) switch (action.intermediates.len) {
|
||||
0 => try self.handler.invokeCharset(.GL, .G2, false),
|
||||
|
@ -767,4 +767,10 @@ const StreamHandler = struct {
|
||||
) !void {
|
||||
self.terminal.invokeCharset(active, slot, single);
|
||||
}
|
||||
|
||||
pub fn fullReset(
|
||||
self: *StreamHandler,
|
||||
) !void {
|
||||
self.terminal.fullReset();
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user