~leon_plickat/nfm

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH nfm] Use std.ascii.isWhitespace() instead of isSpace()

Details
Message ID
<20221217133120.31962-1-mail@hmachet.com>
DKIM signature
missing
Download raw message
Patch: +14 -14
Deprecated in zig 0.10
---
 src/CommandTokenizer.zig      |  4 ++--
 src/EditableUTF8String.zig    | 20 ++++++++++----------
 src/key-operations/commit.zig |  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/CommandTokenizer.zig b/src/CommandTokenizer.zig
index 9146d7746606..94d9285640dd 100644
--- a/src/CommandTokenizer.zig
+++ b/src/CommandTokenizer.zig
@@ -39,7 +39,7 @@ pub fn next(self: *Self) !?[]const u8 {
            self.end = true;
            return null;
        }
        if (!ascii.isSpace(self.buffer[self.index])) break;
        if (!ascii.isWhitespace(self.buffer[self.index])) break;
    }

    if (self.buffer[self.index] == '"' or self.buffer[self.index] == '\'') {
@@ -67,7 +67,7 @@ pub fn next(self: *Self) !?[]const u8 {
                self.end = true;
                return self.buffer[start_index..];
            }
            if (ascii.isSpace(self.buffer[self.index])) {
            if (ascii.isWhitespace(self.buffer[self.index])) {
                return self.buffer[start_index..self.index];
            }
        }
diff --git a/src/EditableUTF8String.zig b/src/EditableUTF8String.zig
index d6156768ddf1..fdb2ffd51562 100644
--- a/src/EditableUTF8String.zig
+++ b/src/EditableUTF8String.zig
@@ -479,7 +479,7 @@ fn nextWordStart(self: *Self, cursor: Cursor) ?Cursor {
    // Skip non-whitespace.
    while (true) {
        if (C.byte == self.buffer.items.len) return null;
        if (ascii.isSpace(self.buffer.items[C.byte])) break;
        if (ascii.isWhitespace(self.buffer.items[C.byte])) break;
        C = self.cursorRightOf(C) orelse return null;
    }

@@ -487,7 +487,7 @@ fn nextWordStart(self: *Self, cursor: Cursor) ?Cursor {
    while (true) {
        C = self.cursorRightOf(C) orelse break;
        if (C.byte == self.buffer.items.len) return null;
        if (!ascii.isSpace(self.buffer.items[C.byte])) break;
        if (!ascii.isWhitespace(self.buffer.items[C.byte])) break;
    }

    return C;
@@ -569,20 +569,20 @@ fn prevWordStart(self: *Self, cursor: Cursor) ?Cursor {
    var C = cursor;

    // The cursor may be at the end of the line or we may already be at a word start.
    if (C.byte == self.buffer.items.len or !ascii.isSpace(self.buffer.items[C.byte])) {
    if (C.byte == self.buffer.items.len or !ascii.isWhitespace(self.buffer.items[C.byte])) {
        C = self.cursorLeftOf(C) orelse return null;
    }

    // Skip whitespace.
    while (true) {
        if (!ascii.isSpace(self.buffer.items[C.byte])) break;
        if (!ascii.isWhitespace(self.buffer.items[C.byte])) break;
        C = self.cursorLeftOf(C) orelse return null;
    }

    // Skip non-whitespace.
    while (true) {
        const c = self.cursorLeftOf(C) orelse break;
        if (ascii.isSpace(self.buffer.items[c.byte])) break;
        if (ascii.isWhitespace(self.buffer.items[c.byte])) break;
        C = c;
    }

@@ -661,7 +661,7 @@ fn nextWordEnd(self: *Self, cursor: Cursor) ?Cursor {
    // Skip whitespace.
    while (true) {
        if (C.byte == self.buffer.items.len) return null;
        if (!ascii.isSpace(self.buffer.items[C.byte])) break;
        if (!ascii.isWhitespace(self.buffer.items[C.byte])) break;
        C = self.cursorRightOf(C) orelse return null;
    }

@@ -669,7 +669,7 @@ fn nextWordEnd(self: *Self, cursor: Cursor) ?Cursor {
    while (true) {
        C = self.cursorRightOf(C) orelse break;
        if (C.byte == self.buffer.items.len) break;
        if (ascii.isSpace(self.buffer.items[C.byte])) break;
        if (ascii.isWhitespace(self.buffer.items[C.byte])) break;
    }

    return C;
@@ -712,14 +712,14 @@ fn prevWordEnd(self: *Self, cursor: Cursor) ?Cursor {
    // Skip non-whitespace.
    while (true) {
        C = self.cursorLeftOf(C) orelse break;
        if (ascii.isSpace(self.buffer.items[C.byte])) break;
        if (ascii.isWhitespace(self.buffer.items[C.byte])) break;
        if (C.byte == 0) return null;
    }

    // Skip whitespace.
    while (true) {
        const c = self.cursorLeftOf(C) orelse break;
        if (!ascii.isSpace(self.buffer.items[c.byte])) break;
        if (!ascii.isWhitespace(self.buffer.items[c.byte])) break;
        C = c;
    }

@@ -882,7 +882,7 @@ test "EditableUTF8String: killToEndOfLine()" {
// TODO escaped spaces
pub fn getCompletionToken(self: *Self) ?[]const u8 {
    if (self.cursor.byte == 0) return null;
    if (ascii.isSpace(self.buffer.items[self.cursor.byte - 1])) return null;
    if (ascii.isWhitespace(self.buffer.items[self.cursor.byte - 1])) return null;
    const c = self.prevWordStart(self.cursor) orelse return null;
    return self.buffer.items[c.byte..self.cursor.byte];
}
diff --git a/src/key-operations/commit.zig b/src/key-operations/commit.zig
index aa282155ceda..fa89cb24696b 100644
--- a/src/key-operations/commit.zig
+++ b/src/key-operations/commit.zig
@@ -174,10 +174,10 @@ pub const MultiForeground = struct {
    pub fn addFile(self: *MultiForeground, dir: []const u8, file: []const u8) !void {
        const needs_quotes = blk: {
            for (file) |c| {
                if (ascii.isSpace(c)) break :blk true;
                if (ascii.isWhitespace(c)) break :blk true;
            }
            for (dir) |c| {
                if (ascii.isSpace(c)) break :blk true;
                if (ascii.isWhitespace(c)) break :blk true;
            }
            break :blk false;
        };
-- 
2.39.0

[nfm/patches/alpine.yml] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CP44PIY16ZH4.2467BMPD7UOS1@cirno>
In-Reply-To
<20221217133120.31962-1-mail@hmachet.com> (view parent)
DKIM signature
missing
Download raw message
nfm/patches/alpine.yml: FAILED in 42s

[Use std.ascii.isWhitespace() instead of isSpace()][0] from [Hugo Machet][1]

[0]: https://lists.sr.ht/~leon_plickat/nfm/patches/37597
[1]: mail@hmachet.com

✗ #906833 FAILED nfm/patches/alpine.yml https://builds.sr.ht/~leon_plickat/job/906833
Details
Message ID
<CPH1U251FR0L.11X91BRZ9ZPXO@kasten>
In-Reply-To
<20221217133120.31962-1-mail@hmachet.com> (view parent)
DKIM signature
missing
Download raw message
Thanks!


Friendly greetings,
Leon Henrik Plickat
Reply to thread Export thread (mbox)