this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

widgets(terminal): read full codepoints

Only read full codepoints. Some programs will split codepoints between
reads, which can mess with our parser (looking at you, btop)

+19
+19
src/widgets/terminal/Parser.zig
··· 66 66 67 67 inline fn parseGround(self: *Parser, reader: *BufferedReader) !Event { 68 68 var buf: [1]u8 = undefined; 69 + { 70 + std.debug.assert(self.buf.items.len > 0); 71 + // Handle first byte 72 + const len = try std.unicode.utf8ByteSequenceLength(self.buf.items[0]); 73 + var i: usize = 1; 74 + while (i < len) : (i += 1) { 75 + const read = try reader.read(&buf); 76 + if (read == 0) return error.EOF; 77 + try self.buf.append(buf[0]); 78 + } 79 + } 69 80 while (true) { 70 81 if (reader.start == reader.end) return .{ .print = self.buf.items }; 71 82 const n = try reader.read(&buf); ··· 78 89 }, 79 90 else => { 80 91 try self.buf.append(b); 92 + const len = try std.unicode.utf8ByteSequenceLength(b); 93 + var i: usize = 1; 94 + while (i < len) : (i += 1) { 95 + const read = try reader.read(&buf); 96 + if (read == 0) return error.EOF; 97 + 98 + try self.buf.append(buf[0]); 99 + } 81 100 }, 82 101 } 83 102 }