~leon_plickat/nfm

nfm: Quote brackets in insertQuotedSliceAtCursor() v2 PROPOSED

Hugo Machet: 1
 Quote brackets in insertQuotedSliceAtCursor()

 1 files changed, 9 insertions(+), 1 deletions(-)
#888683 running alpine.yml
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~leon_plickat/nfm/patches/37022/mbox | git am -3
Learn more about email & git

[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