diff --git a/src/analytics/projections.zig b/src/analytics/projections.zig index 519b94d..a708e52 100644 --- a/src/analytics/projections.zig +++ b/src/analytics/projections.zig @@ -44,7 +44,7 @@ pub const ResolvedEvent = struct { /// Social Security). Negative = expense (increases withdrawal, e.g. /// college tuition). pub const LifeEvent = struct { - name: [max_name_len]u8 = .{0} ** max_name_len, + name: [max_name_len]u8 = @splat(0), name_len: u8 = 0, start_age: u16, person: u8 = 0, // 0-indexed into birthdates array @@ -112,19 +112,19 @@ pub const UserConfig = struct { /// Target stock allocation percentage (0-100). Used for simulation blending. target_stock_pct: ?f64 = null, /// Retirement horizons to simulate (years). Defaults to 20,30,45. - horizons: [max_horizons]u16 = .{ 20, 30, 45 } ++ .{0} ** (max_horizons - 3), + horizons: [max_horizons]u16 = .{ 20, 30, 45 } ++ @as([max_horizons - 3]u16, @splat(0)), horizon_count: u8 = 3, /// Age-based horizon targets. Resolved at context-load time to /// `target_age − max(currentAges())` years — i.e. how long until the /// oldest configured person hits `target_age`. Rationale: the first /// person to hit the target age sets the meaningful planning horizon, /// because spending typically drops substantially after the first death. - horizon_ages: [max_horizons]u16 = .{0} ** max_horizons, + horizon_ages: [max_horizons]u16 = @splat(0), horizon_age_count: u8 = 0, /// Confidence levels for safe withdrawal. Always 90/95/99. confidence_levels: [3]f64 = .{ 0.90, 0.95, 0.99 }, /// Birthdates for age-based event timing. - birthdates: [max_persons]Date = .{Date.fromYmd(1970, 1, 1)} ** max_persons, + birthdates: [max_persons]Date = @splat(Date.fromYmd(1970, 1, 1)), birthdate_count: u8 = 0, /// Life events (income/expenses) that modify annual cash flow. events: [max_events]LifeEvent = undefined, @@ -160,7 +160,7 @@ pub const UserConfig = struct { /// Compute ages as of a specific date (for testing). pub fn currentAgesAsOf(self: *const UserConfig, as_of: Date) [max_persons]u16 { - var ages: [max_persons]u16 = .{0} ** max_persons; + var ages: [max_persons]u16 = @splat(0); for (0..self.birthdate_count) |i| { const years = Date.yearsBetween(self.birthdates[i], as_of); ages[i] = if (years > 0) @intFromFloat(years) else 0; diff --git a/src/commands/portfolio.zig b/src/commands/portfolio.zig index dddb3dc..fb40627 100644 --- a/src/commands/portfolio.zig +++ b/src/commands/portfolio.zig @@ -228,7 +228,7 @@ pub fn display( const sign: []const u8 = if (a.unrealized_gain_loss >= 0) "+" else "-"; // Date + ST/LT for single-lot positions - var date_col: [24]u8 = .{' '} ** 24; + var date_col: [24]u8 = @splat(' '); var date_col_len: usize = 0; if (!is_multi and lots_for_sym.items.len == 1) { const lot = lots_for_sym.items[0]; diff --git a/src/format.zig b/src/format.zig index 3f4486b..4225345 100644 --- a/src/format.zig +++ b/src/format.zig @@ -255,7 +255,7 @@ pub fn fmtTimeAgo(buf: []u8, timestamp: i64) []const u8 { /// Format large numbers with T/B/M suffixes (e.g. "1.5B", "45.6M"). pub fn fmtLargeNum(val: f64) [15]u8 { - var result: [15]u8 = .{' '} ** 15; + var result: [15]u8 = @splat(' '); if (val >= 1_000_000_000_000) { _ = std.fmt.bufPrint(&result, "{d:.1}T", .{val / 1_000_000_000_000}) catch {}; } else if (val >= 1_000_000_000) { diff --git a/src/tui.zig b/src/tui.zig index 01fa9c5..07a228a 100644 --- a/src/tui.zig +++ b/src/tui.zig @@ -334,14 +334,14 @@ pub const App = struct { // Portfolio navigation cursor: usize = 0, // selected row in portfolio view - expanded: [64]bool = [_]bool{false} ** 64, // which positions are expanded + expanded: [64]bool = @splat(false), // which positions are expanded cash_expanded: bool = false, // whether cash section is expanded to show per-account illiquid_expanded: bool = false, // whether illiquid section is expanded to show per-asset portfolio_rows: std.ArrayList(PortfolioRow) = .empty, prepared_options: ?views.Options = null, prepared_cds: ?views.CDs = null, portfolio_header_lines: usize = 0, // number of styled lines before data rows - portfolio_line_to_row: [256]usize = [_]usize{0} ** 256, // maps styled line index -> portfolio_rows index + portfolio_line_to_row: [256]usize = @splat(0), // maps styled line index -> portfolio_rows index portfolio_line_count: usize = 0, // total styled lines in portfolio view portfolio_sort_field: PortfolioSortField = .symbol, // current sort column portfolio_sort_dir: SortDirection = .asc, // current sort direction @@ -362,9 +362,9 @@ pub const App = struct { // Options navigation (inline expand/collapse like portfolio) options_cursor: usize = 0, // selected row in flattened options view - options_expanded: [64]bool = [_]bool{false} ** 64, // which expirations are expanded - options_calls_collapsed: [64]bool = [_]bool{false} ** 64, // per-expiration: calls section collapsed - options_puts_collapsed: [64]bool = [_]bool{false} ** 64, // per-expiration: puts section collapsed + options_expanded: [64]bool = @splat(false), // which expirations are expanded + options_calls_collapsed: [64]bool = @splat(false), // per-expiration: calls section collapsed + options_puts_collapsed: [64]bool = @splat(false), // per-expiration: puts section collapsed options_near_the_money: usize = 8, // +/- strikes from ATM options_rows: std.ArrayList(OptionsRow) = .empty, options_header_lines: usize = 0, // number of styled lines before data rows @@ -1621,9 +1621,9 @@ pub const App = struct { self.options_loaded = false; self.etf_loaded = false; self.options_cursor = 0; - self.options_expanded = [_]bool{false} ** 64; - self.options_calls_collapsed = [_]bool{false} ** 64; - self.options_puts_collapsed = [_]bool{false} ** 64; + self.options_expanded = @splat(false); + self.options_calls_collapsed = @splat(false); + self.options_puts_collapsed = @splat(false); self.options_rows.clearRetainingCapacity(); self.candle_timestamp = 0; self.options_timestamp = 0; diff --git a/src/tui/options_tab.zig b/src/tui/options_tab.zig index 4c9cb2a..20d4557 100644 --- a/src/tui/options_tab.zig +++ b/src/tui/options_tab.zig @@ -24,9 +24,9 @@ pub fn loadData(app: *App) void { app.options_data = result.data; app.options_timestamp = result.timestamp; app.options_cursor = 0; - app.options_expanded = [_]bool{false} ** 64; - app.options_calls_collapsed = [_]bool{false} ** 64; - app.options_puts_collapsed = [_]bool{false} ** 64; + app.options_expanded = @splat(false); + app.options_calls_collapsed = @splat(false); + app.options_puts_collapsed = @splat(false); app.rebuildOptionsRows(); app.setStatus(if (result.source == .cached) "Cached (1hr TTL) | r/F5 to refresh" else "Fetched | r/F5 to refresh"); } diff --git a/src/tui/portfolio_tab.zig b/src/tui/portfolio_tab.zig index 01b5133..fabf203 100644 --- a/src/tui/portfolio_tab.zig +++ b/src/tui/portfolio_tab.zig @@ -1224,7 +1224,7 @@ pub fn reloadPortfolioFile(app: *App) void { // Recompute summary using cached prices (no network) app.freePortfolioSummary(); - app.expanded = [_]bool{false} ** 64; + app.expanded = @splat(false); app.cash_expanded = false; app.illiquid_expanded = false; app.cursor = 0;