diff --git a/build.zig.zon b/build.zig.zon index b7a4dfd..9536ee2 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -9,8 +9,8 @@ .lazy = true, }, .zg = .{ - .url = "git+https://codeberg.org/dude_the_builder/zg?ref=master#689ab6b83d08c02724b99d199d650ff731250998", - .hash = "12200d1ce5f9733a9437415d85665ad5fbc85a4d27689fd337fecad8014acffe3aa5", + .url = "git+https://codeberg.org/dude_the_builder/zg#7ddce488e074c3f052949ba513a340446cea86e9", + .hash = "12205e2e7108385a1ec280b6365166e902a690d6a0e8fcc015fdea62d63cf79be8ec", }, .libxev = .{ .url = "git+https://github.com/mitchellh/libxev#f6a672a78436d8efee1aa847a43a900ad773618b", diff --git a/src/Loop.zig b/src/Loop.zig index a3d24bf..9ab347c 100644 --- a/src/Loop.zig +++ b/src/Loop.zig @@ -45,7 +45,7 @@ pub fn Loop(comptime T: type) type { if (self.thread) |_| return; self.thread = try std.Thread.spawn(.{}, Self.ttyRun, .{ self, - &self.vaxis.unicode.grapheme_data, + &self.vaxis.unicode.width_data.g_data, self.vaxis.opts.system_clipboard_allocator, }); } diff --git a/src/Unicode.zig b/src/Unicode.zig index b9c3b4e..a2ae55a 100644 --- a/src/Unicode.zig +++ b/src/Unicode.zig @@ -5,24 +5,21 @@ const DisplayWidth = @import("DisplayWidth"); /// A thin wrapper around zg data const Unicode = @This(); -grapheme_data: grapheme.GraphemeData, width_data: DisplayWidth.DisplayWidthData, /// initialize all unicode data vaxis may possibly need pub fn init(alloc: std.mem.Allocator) !Unicode { return .{ - .grapheme_data = try grapheme.GraphemeData.init(alloc), .width_data = try DisplayWidth.DisplayWidthData.init(alloc), }; } /// free all data pub fn deinit(self: *const Unicode) void { - self.grapheme_data.deinit(); self.width_data.deinit(); } /// creates a grapheme iterator based on str pub fn graphemeIterator(self: *const Unicode, str: []const u8) grapheme.Iterator { - return grapheme.Iterator.init(str, &self.grapheme_data); + return grapheme.Iterator.init(str, &self.width_data.g_data); } diff --git a/src/aio.zig b/src/aio.zig index 27626ae..4d935e8 100644 --- a/src/aio.zig +++ b/src/aio.zig @@ -116,7 +116,7 @@ pub fn LoopWithModules(T: type, aio: type, coro: type) type { } var parser: vaxis.Parser = .{ - .grapheme_data = &vx.unicode.grapheme_data, + .grapheme_data = &vx.unicode.width_data.g_data, }; const file: std.fs.File = .{ .handle = tty.fd }; diff --git a/src/widgets/terminal/Terminal.zig b/src/widgets/terminal/Terminal.zig index 5ce698b..67c40fe 100644 --- a/src/widgets/terminal/Terminal.zig +++ b/src/widgets/terminal/Terminal.zig @@ -291,7 +291,7 @@ fn run(self: *Terminal) !void { switch (event) { .print => |str| { - var iter = grapheme.Iterator.init(str, &self.unicode.grapheme_data); + var iter = grapheme.Iterator.init(str, &self.unicode.width_data.g_data); while (iter.next()) |g| { const gr = g.bytes(str); // TODO: use actual instead of .unicode diff --git a/src/xev.zig b/src/xev.zig index 0cf36f4..13cd4d2 100644 --- a/src/xev.zig +++ b/src/xev.zig @@ -76,7 +76,7 @@ pub fn TtyWatcher(comptime Userdata: type) type { .callback = callback, .ud = userdata, .vx = vaxis, - .parser = .{ .grapheme_data = &vaxis.unicode.grapheme_data }, + .parser = .{ .grapheme_data = &vaxis.unicode.width_data.g_data }, }; self.file.read(