mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-14 19:45:49 +00:00
benchmark: generate more types of OSC sequences
This commit is contained in:
@@ -265,3 +265,16 @@ test "percent 7" {
|
||||
@memcpy(&src, s);
|
||||
try std.testing.expectError(error.DecodeError, urlPercentDecode(&src));
|
||||
}
|
||||
|
||||
/// Is the given character valid in URI percent encoding?
|
||||
fn isValidChar(c: u8) bool {
|
||||
return switch (c) {
|
||||
' ', ';', '=' => false,
|
||||
else => return std.ascii.isPrint(c),
|
||||
};
|
||||
}
|
||||
|
||||
/// Write data to the writer after URI percent encoding.
|
||||
pub fn urlPercentEncode(writer: *std.Io.Writer, data: []const u8) std.Io.Writer.Error!void {
|
||||
try std.Uri.Component.percentEncode(writer, data, isValidChar);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user