terminal: ED handles invalid values

This commit is contained in:
Mitchell Hashimoto
2023-11-19 20:47:04 -08:00
parent 39c2549b1a
commit b5cad7184d

View File

@ -294,7 +294,10 @@ pub fn Stream(comptime Handler: type) type {
const mode_: ?csi.EraseDisplay = switch (action.params.len) {
0 => .below,
1 => if (action.params[0] <= 3) @enumFromInt(action.params[0]) else null,
1 => if (action.params[0] <= 3)
std.meta.intToEnum(csi.EraseDisplay, action.params[0]) catch null
else
null,
else => null,
};