[PATCH nfm] Quote brackets in insertQuotedSliceAtCursor()
Export this patch
---
Needed for file like `foo(1).txt`
src/EditableUTF8String.zig | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/EditableUTF8String.zig b/src/EditableUTF8String.zig
index 01e3a2446b1e..532c8d0c0726 100644
--- a/src/EditableUTF8String.zig
+++ b/src/EditableUTF8String.zig
@@ -407,7 +407,7 @@ pub fn insertQuotedSliceAtCursor(self: *Self, in: []const u8) !void {
var escaped: bool = false;
for (in) |byte| {
switch (byte) {
- ' ', '\t', '\n', '\'' => quoted = true,
+ ' ', '\t', '\n', '\'', '(', ')' => quoted = true,
'"' => escaped = true,
else => {},
}
@@ -453,6 +453,14 @@ test "EditableUTF8String: insertQuotedSliceAtCursor()" {
try std.testing.expectEqualSlices(u8, "word \"'j'\"", a.buffer.items);
a.deinit();
}
+
+ {
+ const str = "word";
+ var a = try Self.from(str);
+ try a.insertQuotedSliceAtCursor("(1");
+ try std.testing.expectEqualSlices(u8, "word\"(1)\"", a.buffer.items);
+ a.deinit();
+ }
}
pub fn insertCodepointAtCursor(self: *Self, cp: u21) !void {
--
2.38.1
Turns out I applied this a month ago and never told you...
Thanks!
Friendly greetings,
Leon Henrik Plickat