remove some unreachables, log errors to avoid crashes

These are still TODO but we don't want to crash on bad input.
This commit is contained in:
Mitchell Hashimoto
2023-08-31 14:55:27 -07:00
parent 2d6fae0466
commit d05381db83
2 changed files with 6 additions and 4 deletions

View File

@ -990,7 +990,11 @@ pub fn setCursorColAbsolute(self: *Terminal, col_req: usize) void {
// TODO: test // TODO: test
assert(!self.modes.get(.origin)); // TODO // TODO
if (!self.modes.get(.origin)) {
log.err("setCursorColAbsolute: cursor origin mode handling not implemented yet", .{});
return;
}
if (self.status_display != .main) return; // TODO if (self.status_display != .main) return; // TODO
@ -1116,7 +1120,6 @@ pub fn eraseLine(
else => { else => {
log.err("unimplemented erase line mode: {}", .{mode}); log.err("unimplemented erase line mode: {}", .{mode});
@panic("unimplemented");
}, },
} }
} }

View File

@ -1216,8 +1216,7 @@ const StreamHandler = struct {
pub fn setCursorRow(self: *StreamHandler, row: u16) !void { pub fn setCursorRow(self: *StreamHandler, row: u16) !void {
if (self.terminal.modes.get(.origin)) { if (self.terminal.modes.get(.origin)) {
// TODO // TODO
log.err("setCursorRow: implement origin mode", .{}); log.err("setCursorRow: unimplemented origin mode handling, misrendering may occur", .{});
unreachable;
} }
self.terminal.setCursorPos(row, self.terminal.screen.cursor.x + 1); self.terminal.setCursorPos(row, self.terminal.screen.cursor.x + 1);