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