mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 05:50:27 +00:00
Compare fields directly instead of PackedStyle
Comparing the fields directly is actually faster than PackedStyle
This commit is contained in:
@@ -85,9 +85,10 @@ pub const Style = struct {
|
||||
|
||||
/// True if the style is equal to another style.
|
||||
pub fn eql(self: Style, other: Style) bool {
|
||||
// We convert the styles to packed structs and compare as integers
|
||||
// because this is much faster than comparing each field separately.
|
||||
return PackedStyle.fromStyle(self) == PackedStyle.fromStyle(other);
|
||||
return @as(u16, @bitCast(self.flags)) == @as(u16, @bitCast(other.flags)) and
|
||||
std.meta.eql(self.fg_color, other.fg_color) and
|
||||
std.meta.eql(self.bg_color, other.bg_color) and
|
||||
std.meta.eql(self.underline_color, other.underline_color);
|
||||
}
|
||||
|
||||
/// Returns the bg color for a cell with this style given the cell
|
||||
|
||||
Reference in New Issue
Block a user