Skip to content

Commit 5c42f8e

Browse files
authored
fix: change ** to @Splat() (#108)
1 parent 7b3bd53 commit 5c42f8e

11 files changed

Lines changed: 20 additions & 20 deletions

File tree

examples/tooltip.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Model = struct {
1717
status: []const u8,
1818

1919
// Button positions (computed in view, used for tooltip targeting)
20-
btn_positions: [7]ButtonPos = [_]ButtonPos{.{}} ** 7,
20+
btn_positions: [7]ButtonPos = @splat(.{}),
2121

2222
const ButtonPos = struct {
2323
x: usize = 0,

src/components/calendar.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub const Calendar = struct {
2020
/// Week starts on Monday (true) or Sunday (false).
2121
week_start_monday: bool = true,
2222
/// Marked dates with colors.
23-
marked_days: [31]?Color = .{null} ** 31,
23+
marked_days: [31]?Color = @splat(null),
2424
/// Focused state.
2525
focused: bool = true,
2626

@@ -117,7 +117,7 @@ pub const Calendar = struct {
117117
}
118118

119119
pub fn clearMarkedDates(self: *Calendar) void {
120-
self.marked_days = .{null} ** 31;
120+
self.marked_days = @splat(null);
121121
}
122122

123123
pub fn update(self: *Calendar, key: keys.KeyEvent) void {

src/components/context_menu.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub fn ContextMenu(comptime Action: type) type {
5151

5252
pub fn init() Self {
5353
return .{
54-
.items = [_]?MenuItem{null} ** max_items,
54+
.items = @splat(null),
5555
.item_count = 0,
5656
.visible = false,
5757
.cursor = 0,

src/components/focus.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub fn FocusGroup(comptime max_items: usize) type {
8989
ptr: *anyopaque,
9090
};
9191

92-
items: [max_items]?FocusItem = [_]?FocusItem{null} ** max_items,
92+
items: [max_items]?FocusItem = @splat(null),
9393
count: usize = 0,
9494
active: usize = 0,
9595
/// Whether cycling wraps from last to first (and vice versa).

src/components/form.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub fn Form(comptime max_fields: usize) type {
7676

7777
pub fn init() Self {
7878
return .{
79-
.fields = [_]?Field{null} ** max_fields,
79+
.fields = @splat(null),
8080
.field_count = 0,
8181
.focus_group = .{},
8282
.submitted = false,

src/components/menu_bar.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub fn MenuBar(comptime Action: type) type {
7171

7272
pub fn init() Self {
7373
return .{
74-
.menus = [_]?Menu{null} ** max_menus,
74+
.menus = @splat(null),
7575
.menu_count = 0,
7676
.state = .closed,
7777
.active_menu = 0,
@@ -143,7 +143,7 @@ pub fn MenuBar(comptime Action: type) type {
143143
var menu = Menu{
144144
.label = label,
145145
.accelerator = accelerator,
146-
.items = [_]?MenuItem{null} ** max_items,
146+
.items = @splat(null),
147147
.item_count = 0,
148148
};
149149

src/components/modal.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub const Modal = struct {
6464

6565
// ── Buttons ────────────────────────────────────────────────────────
6666

67-
buttons: [max_buttons]?Button = [_]?Button{null} ** max_buttons,
67+
buttons: [max_buttons]?Button = @splat(null),
6868
button_count: usize = 0,
6969
selected_button: usize = 0,
7070

@@ -254,7 +254,7 @@ pub const Modal = struct {
254254

255255
/// Remove all buttons.
256256
pub fn clearButtons(self: *Modal) void {
257-
self.buttons = [_]?Button{null} ** max_buttons;
257+
self.buttons = @splat(null);
258258
self.button_count = 0;
259259
self.selected_button = 0;
260260
}

src/components/sortable_table.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ pub fn SortableTable(comptime num_cols: usize) type {
2727
filter_active: bool = false,
2828

2929
// Display
30-
col_widths: [num_cols]?u16 = .{null} ** num_cols,
31-
col_aligns: [num_cols]Align = .{.left} ** num_cols,
30+
col_widths: [num_cols]?u16 = @splat(null),
31+
col_aligns: [num_cols]Align = @splat(.left),
3232
show_header: bool = true,
3333
show_border: bool = true,
3434
border_chars: border_mod.BorderChars = .normal,
@@ -68,7 +68,7 @@ pub fn SortableTable(comptime num_cols: usize) type {
6868
pub fn init(allocator: std.mem.Allocator) Self {
6969
return .{
7070
.allocator = allocator,
71-
.headers = .{""} ** num_cols,
71+
.headers = @splat(""),
7272
.rows = std.array_list.Managed([num_cols][]const u8).init(allocator),
7373
.view_indices = std.array_list.Managed(usize).init(allocator),
7474
.filter_text = std.array_list.Managed(u8).init(allocator),

src/components/styled_list.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub const StyledList = struct {
8181
const writer = &result.writer;
8282

8383
// Track counters per depth level
84-
var counters: [16]usize = .{0} ** 16;
84+
var counters: [16]usize = @splat(0);
8585

8686
for (self.items.items, 0..) |item, i| {
8787
if (i > 0) try writer.writeAll("\n");

src/components/table.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ pub fn Table(comptime num_cols: usize) type {
5454
pub fn init(allocator: std.mem.Allocator) Self {
5555
return .{
5656
.allocator = allocator,
57-
.headers = .{""} ** num_cols,
57+
.headers = @splat(""),
5858
.rows = std.array_list.Managed([num_cols][]const u8).init(allocator),
59-
.col_widths = .{null} ** num_cols,
60-
.col_aligns = .{.left} ** num_cols,
59+
.col_widths = @splat(null),
60+
.col_aligns = @splat(.left),
6161
.border_chars = .normal,
6262
.show_header = true,
6363
.show_border = true,
@@ -230,7 +230,7 @@ pub fn Table(comptime num_cols: usize) type {
230230

231231
/// Calculate actual column widths
232232
fn calculateWidths(self: *const Self) [num_cols]usize {
233-
var widths: [num_cols]usize = .{0} ** num_cols;
233+
var widths: [num_cols]usize = @splat(0);
234234

235235
// Check headers
236236
for (0..num_cols) |i| {

0 commit comments

Comments
 (0)