mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-20 10:46:07 +03:00
use decl literals as suggested
Applied from the code review Co-authored-by: Leah Amelia Chen <github@acc.pluie.me>
This commit is contained in:

committed by
Mitchell Hashimoto

parent
000c894ad2
commit
ecafe92516
@ -6717,9 +6717,7 @@ pub const QuickTerminalSize = struct {
|
||||
|
||||
pub const Type = enum(u8) { none, percentage, pixels };
|
||||
|
||||
fn none() CSize {
|
||||
return .{ .type = .none, .value = 0 };
|
||||
}
|
||||
pub const none: CSize = .{ .type = .none, .value = 0 };
|
||||
|
||||
fn percentage(v: f32) CSize {
|
||||
return .{ .type = .percentage, .value = @bitCast(v) };
|
||||
@ -6733,13 +6731,13 @@ pub const QuickTerminalSize = struct {
|
||||
pub fn cval(self: QuickTerminalSize) C {
|
||||
return .{
|
||||
.primary = if (self.primary) |p| switch (p) {
|
||||
.percentage => |v| CSize.percentage(v),
|
||||
.pixels => |v| CSize.pixels(v),
|
||||
} else CSize.none(),
|
||||
.percentage => |v| .percentage(v),
|
||||
.pixels => |v| .pixels(v),
|
||||
} else .none,
|
||||
.secondary = if (self.secondary) |s| switch (s) {
|
||||
.percentage => |v| CSize.percentage(v),
|
||||
.pixels => |v| CSize.pixels(v),
|
||||
} else CSize.none(),
|
||||
.percentage => |v| .percentage(v),
|
||||
.pixels => |v| .pixels(v),
|
||||
} else .none,
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user