aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/unicode/grapheme.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-10 21:51:57 +0300
committerGitHub <noreply@github.com>2026-09-10 21:51:57 +0300
commit425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch)
treee52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/unicode/grapheme.zig
parent90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff)
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/unicode/grapheme.zig')
-rw-r--r--vendor/libghostty-vt/src/unicode/grapheme.zig24
1 files changed, 15 insertions, 9 deletions
diff --git a/vendor/libghostty-vt/src/unicode/grapheme.zig b/vendor/libghostty-vt/src/unicode/grapheme.zig
index 73782dd6..79968935 100644
--- a/vendor/libghostty-vt/src/unicode/grapheme.zig
+++ b/vendor/libghostty-vt/src/unicode/grapheme.zig
@@ -141,22 +141,28 @@ inline fn invalidCodepoint(cp: anytype) bool {
/// This is all the structures and data for the precomputed lookup table
/// for all possible permutations of state and grapheme break properties.
-/// Precomputation requires 2^13 keys of 4 bit values so the whole table is
-/// 8KB.
+/// Precomputation requires 2^13 keys of byte-sized values so the whole
+/// table is 8KB.
const Precompute = struct {
const Key = packed struct(u13) {
state: uucode.grapheme.BreakState,
- gb1: uucode.x.types.GraphemeBreakNoControl,
- gb2: uucode.x.types.GraphemeBreakNoControl,
+ gb1: uucode.types.GraphemeBreakNoControl,
+ gb2: uucode.types.GraphemeBreakNoControl,
fn index(self: Key) usize {
return @intCast(@as(u13, @bitCast(self)));
}
};
- const Value = packed struct(u4) {
+ const Value = packed struct(u8) {
result: bool,
state: uucode.grapheme.BreakState,
+
+ /// Explicit padding to give the struct a power-of-two backing
+ /// integer, for the same reason as `Properties._padding` (avoids
+ /// exotic-width LLVM integer accesses that defeat register
+ /// promotion). @sizeOf was already 1, so the table stays 8KB.
+ _padding: u4 = 0,
};
const data = precompute: {
@@ -171,18 +177,18 @@ const Precompute = struct {
};
@setEvalBranchQuota(10_000);
- const info = @typeInfo(uucode.x.types.GraphemeBreakNoControl).@"enum";
+ const info = @typeInfo(uucode.types.GraphemeBreakNoControl).@"enum";
for (0..max_state_int + 1) |state_int| {
for (info.fields) |field1| {
for (info.fields) |field2| {
var state: uucode.grapheme.BreakState = @enumFromInt(state_int);
const key: Key = .{
- .gb1 = @field(uucode.x.types.GraphemeBreakNoControl, field1.name),
- .gb2 = @field(uucode.x.types.GraphemeBreakNoControl, field2.name),
+ .gb1 = @field(uucode.types.GraphemeBreakNoControl, field1.name),
+ .gb2 = @field(uucode.types.GraphemeBreakNoControl, field2.name),
.state = state,
};
- const v = uucode.x.grapheme.computeGraphemeBreakNoControl(
+ const v = uucode.grapheme.computeGraphemeBreakNoControl(
key.gb1,
key.gb2,
&state,