mirror of
https://github.com/ziglang/zig.git
synced 2025-12-16 11:13:08 +00:00
std.io.tty: Remove unused Config.writeDEC() function
For reference: https://github.com/ziglang/zig/pull/15806#discussion_r1203377118
This commit is contained in:
parent
5d3f3cae64
commit
93d9c9bf31
@ -123,34 +123,4 @@ pub const Config = union(enum) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn writeDEC(conf: Config, writer: anytype, codepoint: u8) !void {
|
|
||||||
const bytes = switch (conf) {
|
|
||||||
.no_color, .windows_api => switch (codepoint) {
|
|
||||||
0x50...0x5e => @as(*const [1]u8, &codepoint),
|
|
||||||
0x6a => "+", // ┘
|
|
||||||
0x6b => "+", // ┐
|
|
||||||
0x6c => "+", // ┌
|
|
||||||
0x6d => "+", // └
|
|
||||||
0x6e => "+", // ┼
|
|
||||||
0x71 => "-", // ─
|
|
||||||
0x74 => "+", // ├
|
|
||||||
0x75 => "+", // ┤
|
|
||||||
0x76 => "+", // ┴
|
|
||||||
0x77 => "+", // ┬
|
|
||||||
0x78 => "|", // │
|
|
||||||
else => " ", // TODO
|
|
||||||
},
|
|
||||||
.escape_codes => switch (codepoint) {
|
|
||||||
// Here we avoid writing the DEC beginning sequence and
|
|
||||||
// ending sequence in separate syscalls by putting the
|
|
||||||
// beginning and ending sequence into the same string
|
|
||||||
// literals, to prevent terminals ending up in bad states
|
|
||||||
// in case a crash happens between syscalls.
|
|
||||||
inline 0x50...0x7f => |x| "\x1B\x28\x30" ++ [1]u8{x} ++ "\x1B\x28\x42",
|
|
||||||
else => unreachable,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return writer.writeAll(bytes);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user