mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-25 10:11:55 +00:00
style: use decl literals
This commit changes a LOT of areas of the code to use decl literals instead of redundantly referring to the type. These changes were mostly driven by some regex searches and then manual adjustment on a case-by-case basis. I almost certainly missed quite a few places where decl literals could be used, but this is a good first step in converting things, and other instances can be addressed when they're discovered. I tested GLFW+Metal and building the framework on macOS and tested a GTK build on Linux, so I'm 99% sure I didn't introduce any syntax errors or other problems with this. (fingers crossed)
This commit is contained in:
@@ -155,7 +155,7 @@ pub fn init(
|
||||
|
||||
return .{
|
||||
.alloc = alloc,
|
||||
.config = DerivedConfig.init(config),
|
||||
.config = .init(config),
|
||||
.loop = loop,
|
||||
.wakeup = wakeup_h,
|
||||
.stop = stop_h,
|
||||
|
||||
@@ -62,7 +62,7 @@ pub fn style(
|
||||
}
|
||||
|
||||
// Otherwise, we use whatever style the terminal wants.
|
||||
return Style.fromTerminal(state.terminal.screen.cursor.cursor_style);
|
||||
return .fromTerminal(state.terminal.screen.cursor.cursor_style);
|
||||
}
|
||||
|
||||
test "cursor: default uses configured style" {
|
||||
|
||||
@@ -179,7 +179,7 @@ pub const Set = struct {
|
||||
if (current) |*sel| {
|
||||
sel.endPtr().* = cell_pin;
|
||||
} else {
|
||||
current = terminal.Selection.init(
|
||||
current = .init(
|
||||
cell_pin,
|
||||
cell_pin,
|
||||
false,
|
||||
|
||||
@@ -44,7 +44,7 @@ fn ArrayListPool(comptime T: type) type {
|
||||
};
|
||||
|
||||
for (self.lists) |*list| {
|
||||
list.* = try ArrayListT.initCapacity(alloc, initial_capacity);
|
||||
list.* = try .initCapacity(alloc, initial_capacity);
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@@ -22,7 +22,7 @@ pub const Size = struct {
|
||||
/// taking the screen size, removing padding, and dividing by the cell
|
||||
/// dimensions.
|
||||
pub fn grid(self: Size) GridSize {
|
||||
return GridSize.init(self.screen.subPadding(self.padding), self.cell);
|
||||
return .init(self.screen.subPadding(self.padding), self.cell);
|
||||
}
|
||||
|
||||
/// The size of the terminal. This is the same as the screen without
|
||||
@@ -39,7 +39,7 @@ pub const Size = struct {
|
||||
self.padding = explicit;
|
||||
|
||||
// Now we can calculate the balanced padding
|
||||
self.padding = Padding.balanced(
|
||||
self.padding = .balanced(
|
||||
self.screen,
|
||||
self.grid(),
|
||||
self.cell,
|
||||
|
||||
Reference in New Issue
Block a user