terminal: address typos in style struct

This commit is contained in:
Mitchell Hashimoto
2024-12-24 12:07:58 -08:00
parent 5052be3efe
commit d7542ec504

View File

@ -240,13 +240,15 @@ pub const Style = struct {
} }
/// `PackedStyle` represents the same data as `Style` but without padding, /// `PackedStyle` represents the same data as `Style` but without padding,
/// which is necassary for hashing via re-interpretation of the underlying bytes. /// which is necessary for hashing via re-interpretation of the underlying
/// bytes.
/// ///
/// `Style` is still prefered for everything else as it has type-safety when using /// `Style` is still preferred for everything else as it has type-safety
/// the `Color` tagged union. /// when using the `Color` tagged union.
/// ///
/// Empirical testing shows that storing all of the tags first and then the datas /// Empirical testing shows that storing all of the tags first and then the
/// provides a better layout for serializing into and is faster on benchmarks. /// data provides a better layout for serializing into and is faster on
/// benchmarks.
const PackedStyle = packed struct(u128) { const PackedStyle = packed struct(u128) {
tags: packed struct { tags: packed struct {
fg: Color.Tag, fg: Color.Tag,
@ -261,10 +263,12 @@ pub const Style = struct {
flags: Flags, flags: Flags,
_padding: u16 = 0, _padding: u16 = 0,
/// After https://github.com/ziglang/zig/issues/19754 is implemented, it /// After https://github.com/ziglang/zig/issues/19754 is implemented,
/// will be an compiler-error to have packed union fields of differing size. /// it will be an compiler-error to have packed union fields of
/// differing size.
/// ///
/// For now we just need to be careful not to accidentally introduce padding. /// For now we just need to be careful not to accidentally introduce
/// padding.
const Data = packed union { const Data = packed union {
none: u24, none: u24,
palette: packed struct(u24) { palette: packed struct(u24) {