mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-07 02:16:34 +00:00
terminal: hasText no longer special cases kitty placeholders
This commit is contained in:
@@ -228,6 +228,12 @@ pub const RunIterator = struct {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're a Kitty unicode placeholder then we add a blank.
|
||||||
|
if (cell.codepoint() == terminal.kitty.graphics.unicode.placeholder) {
|
||||||
|
try self.addCodepoint(&hasher, ' ', @intCast(cluster));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Add all the codepoints for our grapheme
|
// Add all the codepoints for our grapheme
|
||||||
try self.addCodepoint(
|
try self.addCodepoint(
|
||||||
&hasher,
|
&hasher,
|
||||||
@@ -284,8 +290,20 @@ pub const RunIterator = struct {
|
|||||||
style: font.Style,
|
style: font.Style,
|
||||||
presentation: ?font.Presentation,
|
presentation: ?font.Presentation,
|
||||||
) !?font.Collection.Index {
|
) !?font.Collection.Index {
|
||||||
|
if (cell.isEmpty() or
|
||||||
|
cell.codepoint() == 0 or
|
||||||
|
cell.codepoint() == terminal.kitty.graphics.unicode.placeholder)
|
||||||
|
{
|
||||||
|
return try self.grid.getIndex(
|
||||||
|
alloc,
|
||||||
|
' ',
|
||||||
|
style,
|
||||||
|
presentation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Get the font index for the primary codepoint.
|
// Get the font index for the primary codepoint.
|
||||||
const primary_cp: u32 = if (cell.isEmpty() or cell.codepoint() == 0) ' ' else cell.codepoint();
|
const primary_cp: u32 = cell.codepoint();
|
||||||
const primary = try self.grid.getIndex(
|
const primary = try self.grid.getIndex(
|
||||||
alloc,
|
alloc,
|
||||||
primary_cp,
|
primary_cp,
|
||||||
|
@@ -1705,8 +1705,7 @@ pub const Cell = packed struct(u64) {
|
|||||||
return switch (self.content_tag) {
|
return switch (self.content_tag) {
|
||||||
.codepoint,
|
.codepoint,
|
||||||
.codepoint_grapheme,
|
.codepoint_grapheme,
|
||||||
=> self.content.codepoint != 0 and
|
=> self.content.codepoint != 0,
|
||||||
self.content.codepoint != kitty.graphics.unicode.placeholder,
|
|
||||||
|
|
||||||
.bg_color_palette,
|
.bg_color_palette,
|
||||||
.bg_color_rgb,
|
.bg_color_rgb,
|
||||||
@@ -1738,8 +1737,7 @@ pub const Cell = packed struct(u64) {
|
|||||||
return self.style_id != style.default_id;
|
return self.style_id != style.default_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if the cell has no text or styling. This also returns
|
/// Returns true if the cell has no text or styling.
|
||||||
/// true if the cell represents a Kitty graphics unicode placeholder.
|
|
||||||
pub fn isEmpty(self: Cell) bool {
|
pub fn isEmpty(self: Cell) bool {
|
||||||
return switch (self.content_tag) {
|
return switch (self.content_tag) {
|
||||||
// Textual cells are empty if they have no text and are narrow.
|
// Textual cells are empty if they have no text and are narrow.
|
||||||
@@ -2671,12 +2669,3 @@ test "Page verifyIntegrity zero cols" {
|
|||||||
page.verifyIntegrity(testing.allocator),
|
page.verifyIntegrity(testing.allocator),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
test "Cell isEmpty for kitty placeholder" {
|
|
||||||
var c: Cell = .{
|
|
||||||
.content_tag = .codepoint_grapheme,
|
|
||||||
.content = .{ .codepoint = kitty.graphics.unicode.placeholder },
|
|
||||||
};
|
|
||||||
try testing.expectEqual(@as(u21, kitty.graphics.unicode.placeholder), c.codepoint());
|
|
||||||
try testing.expect(c.isEmpty());
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user