From cf0d498e75dea22c8154274ce39cacda7842ff14 Mon Sep 17 00:00:00 2001 From: Erlend Lind Madsen Date: Fri, 9 Feb 2024 20:04:51 +0100 Subject: [PATCH 1/3] replace ziglyph codePointWidth -> table.get --- src/Surface.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Surface.zig b/src/Surface.zig index 71d600fbe..db38c65ad 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -21,7 +21,7 @@ const assert = std.debug.assert; const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const oni = @import("oniguruma"); -const ziglyph = @import("ziglyph"); +const unicode = @import("unicode/main.zig"); const main = @import("main.zig"); const renderer = @import("renderer.zig"); const termio = @import("termio.zig"); @@ -1231,7 +1231,7 @@ pub fn preeditCallback(self: *Surface, preedit_: ?[]const u8) !void { var codepoints: std.ArrayListUnmanaged(Codepoint) = .{}; defer codepoints.deinit(self.alloc); while (it.nextCodepoint()) |cp| { - const width = ziglyph.display_width.codePointWidth(cp, .half); + const width: usize = if (cp <= 0xFF) 1 else @intCast(unicode.table.get(cp).width); // I've never seen a preedit text with a zero-width character. In // theory its possible but we can't really handle it right now. From ca426a4267f1cb238222863d26d21dad4b3fd46b Mon Sep 17 00:00:00 2001 From: Erlend Lind Madsen Date: Fri, 9 Feb 2024 20:05:11 +0100 Subject: [PATCH 2/3] remove unused ziglyph import --- src/helpgen.zig | 1 - 1 file changed, 1 deletion(-) diff --git a/src/helpgen.zig b/src/helpgen.zig index 5a9c40b25..2084fb9f7 100644 --- a/src/helpgen.zig +++ b/src/helpgen.zig @@ -3,7 +3,6 @@ //! help, docs, website, etc. const std = @import("std"); -const ziglyph = @import("ziglyph"); const Config = @import("config/Config.zig"); const Action = @import("cli/action.zig").Action; const KeybindAction = @import("input/Binding.zig").Action; From 928d338c2b7e5224449f8c37be1c392e3c2cb5cf Mon Sep 17 00:00:00 2001 From: Erlend Lind Madsen Date: Fri, 9 Feb 2024 21:44:54 +0100 Subject: [PATCH 3/3] preeditCallback(self): remove fast path codepoint width --- src/Surface.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Surface.zig b/src/Surface.zig index db38c65ad..e9b27f05a 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -1231,7 +1231,7 @@ pub fn preeditCallback(self: *Surface, preedit_: ?[]const u8) !void { var codepoints: std.ArrayListUnmanaged(Codepoint) = .{}; defer codepoints.deinit(self.alloc); while (it.nextCodepoint()) |cp| { - const width: usize = if (cp <= 0xFF) 1 else @intCast(unicode.table.get(cp).width); + const width: usize = @intCast(unicode.table.get(cp).width); // I've never seen a preedit text with a zero-width character. In // theory its possible but we can't really handle it right now.