From e5cb7d2b3258be63c4f3868a856f76eabdb49715 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Tue, 17 Mar 2026 10:10:29 -0700 Subject: [PATCH] uppercase the command line symbol name --- TODO.md | 5 ++--- src/tui.zig | 9 +++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index 2423abe..e05c34a 100644 --- a/TODO.md +++ b/TODO.md @@ -27,9 +27,8 @@ question: fixed at 2, or arbitrary N? ## TUI issues -Starting the TUI with a ticker symbol doesn't uppercase (why can't we just solve -this once?). Display artifacts that don't go away when switching tabs (need -specific steps to reproduce). +Display artifacts that don't go away when switching tabs (need specific steps +to reproduce). ## Risk-free rate maintenance diff --git a/src/tui.zig b/src/tui.zig index a8d0830..84688a0 100644 --- a/src/tui.zig +++ b/src/tui.zig @@ -3630,6 +3630,7 @@ pub fn run(allocator: std.mem.Allocator, config: zfin.Config, args: []const []co var portfolio_path: ?[]const u8 = null; var watchlist_path: ?[]const u8 = null; var symbol: []const u8 = ""; + var symbol_upper_buf: [32]u8 = undefined; var has_explicit_symbol = false; var skip_watchlist = false; var chart_config: chart_mod.ChartConfig = .{}; @@ -3656,7 +3657,9 @@ pub fn run(allocator: std.mem.Allocator, config: zfin.Config, args: []const []co } else if (std.mem.eql(u8, args[i], "--symbol") or std.mem.eql(u8, args[i], "-s")) { if (i + 1 < args.len) { i += 1; - symbol = args[i]; + const len = @min(args[i].len, symbol_upper_buf.len); + _ = std.ascii.upperString(symbol_upper_buf[0..len], args[i][0..len]); + symbol = symbol_upper_buf[0..len]; has_explicit_symbol = true; skip_watchlist = true; } @@ -3668,7 +3671,9 @@ pub fn run(allocator: std.mem.Allocator, config: zfin.Config, args: []const []co } } } else if (args[i].len > 0 and args[i][0] != '-') { - symbol = args[i]; + const len = @min(args[i].len, symbol_upper_buf.len); + _ = std.ascii.upperString(symbol_upper_buf[0..len], args[i][0..len]); + symbol = symbol_upper_buf[0..len]; has_explicit_symbol = true; } }