upper case symbol from user
This commit is contained in:
parent
d187664494
commit
3a6b6f1e26
2 changed files with 7 additions and 3 deletions
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue