fix: add ( and ) to escape characters when dropping files in gtk

This commit is contained in:
Ian den Hartog
2025-03-26 19:24:31 +01:00
parent bcff4e18f4
commit 447a889559

View File

@ -23,6 +23,8 @@ pub fn ShellEscapeWriter(comptime T: type) type {
'?', '?',
' ', ' ',
'|', '|',
'(',
')',
=> &[_]u8{ '\\', byte }, => &[_]u8{ '\\', byte },
else => &[_]u8{byte}, else => &[_]u8{byte},
}; };
@ -93,3 +95,12 @@ test "shell escape 6" {
try writer.writeAll("a\"c"); try writer.writeAll("a\"c");
try testing.expectEqualStrings("a\\\"c", fmt.getWritten()); try testing.expectEqualStrings("a\\\"c", fmt.getWritten());
} }
test "shell escape 7" {
var buf: [128]u8 = undefined;
var fmt = std.io.fixedBufferStream(&buf);
var shell: ShellEscapeWriter(@TypeOf(fmt).Writer) = .{ .child_writer = fmt.writer() };
const writer = shell.writer();
try writer.writeAll("a(1)");
try testing.expectEqualStrings("a\(1\)", fmt.getWritten());
}