summaryrefslogtreecommitdiff
path: root/src/simd/codepoint_width.zig
diff options
context:
space:
mode:
authorJacob Sandlund <jacob@jacobsandlund.com>2025-08-17 21:24:27 -0400
committerJacob Sandlund <jacob@jacobsandlund.com>2025-08-17 21:24:27 -0400
commite84d8535f5504d7a47bcba8792f019f6f421336f (patch)
tree174aba5a1b1746d09b6e5afaab2f6fb7efd6a525 /src/simd/codepoint_width.zig
parent1abc9b5e41ed58a2a74008f0f87031a16b2a10ca (diff)
removing all ziglyph imports (aside from unicode/grapheme.zig)
Diffstat (limited to 'src/simd/codepoint_width.zig')
-rw-r--r--src/simd/codepoint_width.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/simd/codepoint_width.zig b/src/simd/codepoint_width.zig
index aab4bdd95..e2383aff1 100644
--- a/src/simd/codepoint_width.zig
+++ b/src/simd/codepoint_width.zig
@@ -4,7 +4,7 @@ const std = @import("std");
extern "c" fn ghostty_simd_codepoint_width(u32) i8;
pub fn codepointWidth(cp: u32) i8 {
- //return @import("ziglyph").display_width.codePointWidth(@intCast(cp), .half);
+ //return @import("uucode").get(.wcwidth, @intCast(cp));
return ghostty_simd_codepoint_width(cp);
}
@@ -19,26 +19,26 @@ test "codepointWidth basic" {
try testing.expectEqual(@as(i8, 2), codepointWidth(0xF900)); // 豈
try testing.expectEqual(@as(i8, 2), codepointWidth(0x20000)); // 𠀀
try testing.expectEqual(@as(i8, 2), codepointWidth(0x30000)); // 𠀀
- // try testing.expectEqual(@as(i8, 1), @import("ziglyph").display_width.codePointWidth(0x100, .half));
+ // try testing.expectEqual(@as(i8, 1), @import("uucode").get(.wcwidth, 0x100));
}
// This is not very fast in debug modes, so its commented by default.
// IMPORTANT: UNCOMMENT THIS WHENEVER MAKING CODEPOINTWIDTH CHANGES.
-// test "codepointWidth matches ziglyph" {
+// test "codepointWidth matches uucode" {
// const testing = std.testing;
-// const ziglyph = @import("ziglyph");
+// const uucode = @import("uucode");
//
// const min = 0xFF + 1; // start outside ascii
-// for (min..std.math.maxInt(u21)) |cp| {
+// for (min..uucode.code_point_range_end) |cp| {
// const simd = codepointWidth(@intCast(cp));
-// const zg = ziglyph.display_width.codePointWidth(@intCast(cp), .half);
-// if (simd != zg) mismatch: {
+// const uu = @min(2, @max(0, uucode.get(.wcwidth, @intCast(cp))));
+// if (simd != uu) mismatch: {
// if (cp == 0x2E3B) {
// try testing.expectEqual(@as(i8, 2), simd);
// break :mismatch;
// }
//
-// std.log.warn("mismatch cp=U+{x} simd={} zg={}", .{ cp, simd, zg });
+// std.log.warn("mismatch cp=U+{x} simd={} uucode={}", .{ cp, simd, uu });
// try testing.expect(false);
// }
// }