title case for etf sectors, force upper case on symbol search
This commit is contained in:
parent
3d679f9d75
commit
71a5c548d5
2 changed files with 8 additions and 4 deletions
|
|
@ -73,10 +73,12 @@ pub fn printProfile(profile: zfin.EtfProfile, symbol: []const u8, color: bool, o
|
||||||
try out.print("\n Sector Allocation:\n", .{});
|
try out.print("\n Sector Allocation:\n", .{});
|
||||||
try cli.reset(out, color);
|
try cli.reset(out, color);
|
||||||
for (sectors) |sec| {
|
for (sectors) |sec| {
|
||||||
|
var title_buf: [64]u8 = undefined;
|
||||||
|
const name = fmt.toTitleCase(&title_buf, sec.name);
|
||||||
try cli.setFg(out, color, cli.CLR_ACCENT);
|
try cli.setFg(out, color, cli.CLR_ACCENT);
|
||||||
try out.print(" {d:>5.1}%", .{sec.weight * 100.0});
|
try out.print(" {d:>5.1}%", .{sec.weight * 100.0});
|
||||||
try cli.reset(out, color);
|
try cli.reset(out, color);
|
||||||
try out.print(" {s}\n", .{sec.name});
|
try out.print(" {s}\n", .{name});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -500,7 +500,8 @@ const App = struct {
|
||||||
return ctx.consumeAndRedraw();
|
return ctx.consumeAndRedraw();
|
||||||
}
|
}
|
||||||
if (key.codepoint >= 0x20 and key.codepoint < 0x7f and self.input_len < self.input_buf.len) {
|
if (key.codepoint >= 0x20 and key.codepoint < 0x7f and self.input_len < self.input_buf.len) {
|
||||||
self.input_buf[self.input_len] = @intCast(key.codepoint);
|
const c: u8 = @intCast(key.codepoint);
|
||||||
|
self.input_buf[self.input_len] = std.ascii.toUpper(c);
|
||||||
self.input_len += 1;
|
self.input_len += 1;
|
||||||
return ctx.consumeAndRedraw();
|
return ctx.consumeAndRedraw();
|
||||||
}
|
}
|
||||||
|
|
@ -2923,8 +2924,9 @@ const App = struct {
|
||||||
try col3.add(arena, "Sectors", th.headerStyle());
|
try col3.add(arena, "Sectors", th.headerStyle());
|
||||||
const show = @min(sectors.len, 7);
|
const show = @min(sectors.len, 7);
|
||||||
for (sectors[0..show]) |sec| {
|
for (sectors[0..show]) |sec| {
|
||||||
// Truncate long sector names
|
var title_buf: [64]u8 = undefined;
|
||||||
const name = if (sec.name.len > 20) sec.name[0..20] else sec.name;
|
const title_name = fmt.toTitleCase(&title_buf, sec.name);
|
||||||
|
const name = if (title_name.len > 20) title_name[0..20] else title_name;
|
||||||
try col3.add(arena, try std.fmt.allocPrint(arena, " {d:>5.1}% {s}", .{ sec.weight * 100.0, name }), th.contentStyle());
|
try col3.add(arena, try std.fmt.allocPrint(arena, " {d:>5.1}% {s}", .{ sec.weight * 100.0, name }), th.contentStyle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue