upper case symbol from user

This commit is contained in:
Emil Lerch 2026-03-10 15:18:12 -07:00
parent d187664494
commit 3a6b6f1e26
Signed by: lobo
GPG key ID: A7B62D657EF764F8
2 changed files with 7 additions and 3 deletions

View file

@ -103,6 +103,11 @@ pub fn main() !u8 {
var svc = zfin.DataService.init(allocator, config);
defer svc.deinit();
// Normalize symbol to uppercase (e.g. "aapl" -> "AAPL")
if (args.len >= 3) {
for (args[2]) |*c| c.* = std.ascii.toUpper(c.*);
}
if (std.mem.eql(u8, command, "perf")) {
if (args.len < 3) {
try cli.stderrPrint("Error: 'perf' requires a symbol argument\n");

View file

@ -476,9 +476,7 @@ const App = struct {
}
if (key.codepoint == vaxis.Key.enter) {
if (self.input_len > 0) {
for (self.input_buf[0..self.input_len]) |*ch| {
if (ch.* >= 'a' and ch.* <= 'z') ch.* = ch.* - 32;
}
for (self.input_buf[0..self.input_len]) |*ch| ch.* = std.ascii.toUpper(ch.*);
@memcpy(self.symbol_buf[0..self.input_len], self.input_buf[0..self.input_len]);
self.symbol = self.symbol_buf[0..self.input_len];
self.symbol_owned = true;
@ -895,6 +893,7 @@ const App = struct {
fn setActiveSymbol(self: *App, sym: []const u8) void {
const len = @min(sym.len, self.symbol_buf.len);
@memcpy(self.symbol_buf[0..len], sym[0..len]);
for (self.symbol_buf[0..len]) |*c| c.* = std.ascii.toUpper(c.*);
self.symbol = self.symbol_buf[0..len];
self.symbol_owned = true;
self.has_explicit_symbol = true;