From 6f8b4204b99463a264b1d2311bce46db7634023e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 9 Feb 2024 20:31:20 -0800 Subject: [PATCH] terminal: use new grapheme break algo --- src/terminal/Terminal.zig | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/terminal/Terminal.zig b/src/terminal/Terminal.zig index 4d5616003..8931f9819 100644 --- a/src/terminal/Terminal.zig +++ b/src/terminal/Terminal.zig @@ -6,7 +6,6 @@ const Terminal = @This(); const std = @import("std"); const builtin = @import("builtin"); -const ziglyph = @import("ziglyph"); const testing = std.testing; const assert = std.debug.assert; const Allocator = std.mem.Allocator; @@ -786,24 +785,19 @@ pub fn print(self: *Terminal, c: u21) !void { if (prev.cell.char == 0) break :grapheme; const grapheme_break = brk: { - var state: u3 = 0; + var state: unicode.GraphemeBreakState = .{}; var cp1: u21 = @intCast(prev.cell.char); if (prev.cell.attrs.grapheme) { var it = row.codepointIterator(prev.x); while (it.next()) |cp2| { // log.debug("cp1={x} cp2={x}", .{ cp1, cp2 }); - assert(!ziglyph.graphemeBreak( - cp1, - cp2, - &state, - )); - + assert(!unicode.graphemeBreak(cp1, cp2, &state)); cp1 = cp2; } } // log.debug("cp1={x} cp2={x} end", .{ cp1, c }); - break :brk ziglyph.graphemeBreak(cp1, c, &state); + break :brk unicode.graphemeBreak(cp1, c, &state); }; // If we can NOT break, this means that "c" is part of a grapheme