[PATCH nfm v2] Quote brackets in insertQuotedSliceAtCursor()
Export this patch
---
Fixed a typo in the test that made it wrong
src/EditableUTF8String.zig | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/EditableUTF8String.zig b/src/EditableUTF8String.zig
index 01e3a2446b1e..d6156768ddf1 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
Thanks!
Friendly greetings,
Leon Henrik Plickat