aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/unicode/props.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-04-04 19:22:04 +0300
committerCan Celik <ogulcancelik@gmail.com>2026-04-05 01:23:06 +0300
commit41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch)
tree3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/src/unicode/props.zig
parent55c138263e190a1e79d4b997bfb9397306c0ec1f (diff)
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/src/unicode/props.zig')
-rw-r--r--vendor/libghostty-vt/src/unicode/props.zig53
1 files changed, 53 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/unicode/props.zig b/vendor/libghostty-vt/src/unicode/props.zig
new file mode 100644
index 00000000..2653f0cc
--- /dev/null
+++ b/vendor/libghostty-vt/src/unicode/props.zig
@@ -0,0 +1,53 @@
+//! Property set per codepoint that Ghostty cares about.
+//!
+//! Adding to this lets you find new properties but also potentially makes
+//! our lookup tables less efficient. Any changes to this should run the
+//! benchmarks in src/bench to verify that we haven't regressed.
+
+const std = @import("std");
+const uucode = @import("uucode");
+
+pub const Properties = packed struct {
+ /// Codepoint width. We clamp to [0, 2] since Ghostty handles control
+ /// characters and we max out at 2 for wide characters (i.e. 3-em dash
+ /// becomes a 2-em dash).
+ width: u2 = 0,
+
+ /// Whether the code point does not contribute to the width of a grapheme
+ /// cluster (not used for single code point cells).
+ width_zero_in_grapheme: bool = false,
+
+ /// Grapheme break property.
+ grapheme_break: uucode.x.types.GraphemeBreakNoControl = .other,
+
+ /// Emoji VS compatibility
+ emoji_vs_base: bool = false,
+
+ // Needed for lut.Generator
+ pub fn eql(a: Properties, b: Properties) bool {
+ return a.width == b.width and
+ a.width_zero_in_grapheme == b.width_zero_in_grapheme and
+ a.grapheme_break == b.grapheme_break and
+ a.emoji_vs_base == b.emoji_vs_base;
+ }
+
+ // Needed for lut.Generator
+ pub fn format(
+ self: Properties,
+ writer: *std.Io.Writer,
+ ) !void {
+ try writer.print(
+ \\.{{
+ \\ .width= {},
+ \\ .width_zero_in_grapheme= {},
+ \\ .grapheme_break= .{s},
+ \\ .emoji_vs_base= {},
+ \\}}
+ , .{
+ self.width,
+ self.width_zero_in_grapheme,
+ @tagName(self.grapheme_break),
+ self.emoji_vs_base,
+ });
+ }
+};