mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-06 18:06:33 +00:00
terminal: hasText no longer special cases kitty placeholders
This commit is contained in:
@@ -228,6 +228,12 @@ pub const RunIterator = struct {
|
||||
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
|
||||
try self.addCodepoint(
|
||||
&hasher,
|
||||
@@ -284,8 +290,20 @@ pub const RunIterator = struct {
|
||||
style: font.Style,
|
||||
presentation: ?font.Presentation,
|
||||
) !?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.
|
||||
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(
|
||||
alloc,
|
||||
primary_cp,
|
||||
|
@@ -1705,8 +1705,7 @@ pub const Cell = packed struct(u64) {
|
||||
return switch (self.content_tag) {
|
||||
.codepoint,
|
||||
.codepoint_grapheme,
|
||||
=> self.content.codepoint != 0 and
|
||||
self.content.codepoint != kitty.graphics.unicode.placeholder,
|
||||
=> self.content.codepoint != 0,
|
||||
|
||||
.bg_color_palette,
|
||||
.bg_color_rgb,
|
||||
@@ -1738,8 +1737,7 @@ pub const Cell = packed struct(u64) {
|
||||
return self.style_id != style.default_id;
|
||||
}
|
||||
|
||||
/// Returns true if the cell has no text or styling. This also returns
|
||||
/// true if the cell represents a Kitty graphics unicode placeholder.
|
||||
/// Returns true if the cell has no text or styling.
|
||||
pub fn isEmpty(self: Cell) bool {
|
||||
return switch (self.content_tag) {
|
||||
// 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),
|
||||
);
|
||||
}
|
||||
|
||||
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