mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
ignore zero-width characters for now
This commit is contained in:
@ -63,8 +63,7 @@ pub const Cell = struct {
|
|||||||
bg: ?color.RGB = null,
|
bg: ?color.RGB = null,
|
||||||
|
|
||||||
/// On/off attributes that can be set
|
/// On/off attributes that can be set
|
||||||
/// TODO: pack it
|
attrs: packed struct {
|
||||||
attrs: struct {
|
|
||||||
bold: u1 = 0,
|
bold: u1 = 0,
|
||||||
underline: u1 = 0,
|
underline: u1 = 0,
|
||||||
inverse: u1 = 0,
|
inverse: u1 = 0,
|
||||||
@ -82,12 +81,22 @@ pub const Cell = struct {
|
|||||||
/// wide character (tail) or following (head).
|
/// wide character (tail) or following (head).
|
||||||
wide_spacer_tail: u1 = 0,
|
wide_spacer_tail: u1 = 0,
|
||||||
wide_spacer_head: u1 = 0,
|
wide_spacer_head: u1 = 0,
|
||||||
|
|
||||||
|
_padding: u1 = 0,
|
||||||
} = .{},
|
} = .{},
|
||||||
|
|
||||||
/// True if the cell should be skipped for drawing
|
/// True if the cell should be skipped for drawing
|
||||||
pub fn empty(self: Cell) bool {
|
pub fn empty(self: Cell) bool {
|
||||||
return self.char == 0;
|
return self.char == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
// We use this test to ensure we always get the right size of the attrs
|
||||||
|
const cell: Cell = .{ .char = 0 };
|
||||||
|
try std.testing.expectEqual(1, @sizeOf(@TypeOf(cell.attrs)));
|
||||||
|
|
||||||
|
log.warn("CELL={}", .{@sizeOf(Cell)});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const RowIterator = struct {
|
pub const RowIterator = struct {
|
||||||
|
@ -346,7 +346,11 @@ pub fn print(self: *Terminal, c: u21) !void {
|
|||||||
// Determine the width of this character so we can handle
|
// Determine the width of this character so we can handle
|
||||||
// non-single-width characters properly.
|
// non-single-width characters properly.
|
||||||
const width = utf8proc.charwidth(c);
|
const width = utf8proc.charwidth(c);
|
||||||
assert(width == 1 or width == 2);
|
assert(width <= 2);
|
||||||
|
|
||||||
|
// For now, we ignore zero-width characters. When we support ligatures,
|
||||||
|
// this will have to change.
|
||||||
|
if (width == 0) return;
|
||||||
|
|
||||||
// If we're soft-wrapping, then handle that first.
|
// If we're soft-wrapping, then handle that first.
|
||||||
if (self.screen.cursor.pending_wrap and self.modes.autowrap == 1)
|
if (self.screen.cursor.pending_wrap and self.modes.autowrap == 1)
|
||||||
|
Reference in New Issue
Block a user