mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
terminal/kitty: rename diacritics to unicode
This commit is contained in:
@ -20,8 +20,7 @@ pub usingnamespace @import("graphics_command.zig");
|
|||||||
pub usingnamespace @import("graphics_exec.zig");
|
pub usingnamespace @import("graphics_exec.zig");
|
||||||
pub usingnamespace @import("graphics_image.zig");
|
pub usingnamespace @import("graphics_image.zig");
|
||||||
pub usingnamespace @import("graphics_storage.zig");
|
pub usingnamespace @import("graphics_storage.zig");
|
||||||
pub const diacritics = @import("graphics_diacritics.zig");
|
pub const unicode = @import("graphics_unicode.zig");
|
||||||
pub const placeholder = diacritics.placeholder;
|
|
||||||
|
|
||||||
test {
|
test {
|
||||||
@import("std").testing.refAllDecls(@This());
|
@import("std").testing.refAllDecls(@This());
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
//! This file contains various logic and data for working with the
|
||||||
|
//! Kitty graphics protocol unicode placeholder, virtual placement feature.
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const assert = std.debug.assert;
|
const assert = std.debug.assert;
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
@ -6,7 +9,7 @@ const testing = std.testing;
|
|||||||
pub const placeholder: u21 = 0x10EEEE;
|
pub const placeholder: u21 = 0x10EEEE;
|
||||||
|
|
||||||
/// Get the row/col index for a diacritic codepoint. These are 0-indexed.
|
/// Get the row/col index for a diacritic codepoint. These are 0-indexed.
|
||||||
pub fn get(cp: u21) ?usize {
|
pub fn getIndex(cp: u21) ?usize {
|
||||||
return std.sort.binarySearch(u21, cp, diacritics, {}, (struct {
|
return std.sort.binarySearch(u21, cp, diacritics, {}, (struct {
|
||||||
fn order(context: void, lhs: u21, rhs: u21) std.math.Order {
|
fn order(context: void, lhs: u21, rhs: u21) std.math.Order {
|
||||||
_ = context;
|
_ = context;
|
||||||
@ -333,6 +336,6 @@ test "sorted" {
|
|||||||
|
|
||||||
test "diacritic" {
|
test "diacritic" {
|
||||||
// Some spot checks based on Kitty behavior
|
// Some spot checks based on Kitty behavior
|
||||||
try testing.expectEqual(30, get(0x483).?);
|
try testing.expectEqual(30, getIndex(0x483).?);
|
||||||
try testing.expectEqual(294, get(0x1d242).?);
|
try testing.expectEqual(294, getIndex(0x1d242).?);
|
||||||
}
|
}
|
@ -1685,7 +1685,7 @@ pub const Cell = packed struct(u64) {
|
|||||||
.codepoint,
|
.codepoint,
|
||||||
.codepoint_grapheme,
|
.codepoint_grapheme,
|
||||||
=> self.content.codepoint != 0 and
|
=> self.content.codepoint != 0 and
|
||||||
self.content.codepoint != kitty.graphics.placeholder,
|
self.content.codepoint != kitty.graphics.unicode.placeholder,
|
||||||
|
|
||||||
.bg_color_palette,
|
.bg_color_palette,
|
||||||
.bg_color_rgb,
|
.bg_color_rgb,
|
||||||
@ -2654,8 +2654,8 @@ test "Page verifyIntegrity zero cols" {
|
|||||||
test "Cell isEmpty for kitty placeholder" {
|
test "Cell isEmpty for kitty placeholder" {
|
||||||
var c: Cell = .{
|
var c: Cell = .{
|
||||||
.content_tag = .codepoint_grapheme,
|
.content_tag = .codepoint_grapheme,
|
||||||
.content = .{ .codepoint = kitty.graphics.placeholder },
|
.content = .{ .codepoint = kitty.graphics.unicode.placeholder },
|
||||||
};
|
};
|
||||||
try testing.expectEqual(@as(u21, kitty.graphics.placeholder), c.codepoint());
|
try testing.expectEqual(@as(u21, kitty.graphics.unicode.placeholder), c.codepoint());
|
||||||
try testing.expect(c.isEmpty());
|
try testing.expect(c.isEmpty());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user