Fixed: Cores not constrained to cpu box and core numbers above 100 cut off

This commit is contained in:
aristocratos 2021-09-24 22:07:01 +02:00
parent 37de9464e1
commit a35a2c6884
1 changed files with 4 additions and 3 deletions

View File

@ -632,10 +632,11 @@ namespace Cpu {
} catch (const std::exception& e) { throw std::runtime_error("graphs, clock, meter : " + (string)e.what()); }
//? Core text and graphs
int cx = 0, cy = 1, cc = 0;
int cx = 0, cy = 1, cc = 0, core_width = (b_column_size == 0 ? 2 : 3);
if (Shared::coreCount >= 100) core_width++;
for (const auto& n : iota(0, Shared::coreCount)) {
out += Mv::to(b_y + cy + 1, b_x + cx + 1) + Theme::c("main_fg") + (Shared::coreCount < 100 ? Fx::b + 'C' + Fx::ub : "")
+ ljust(to_string(n), (b_column_size == 0 ? 2 : 3));
+ ljust(to_string(n), core_width);
if (b_column_size > 0 or extra_width > 0)
out += Theme::c("inactive_fg") + graph_bg * (5 * b_column_size + extra_width) + Mv::l(5 * b_column_size + extra_width)
+ Theme::g("cpu").at(clamp(cpu.core_percent.at(n).back(), 0ll, 100ll)) + core_graphs.at(n)(cpu.core_percent.at(n), data_same or redraw);
@ -654,7 +655,7 @@ namespace Cpu {
out += Theme::c("div_line") + Symbols::v_line;
if (++cy > ceil((double)Shared::coreCount / b_columns) and n != Shared::coreCount - 1) {
if ((++cy > ceil((double)Shared::coreCount / b_columns) or cy == b_height - 2) and n != Shared::coreCount - 1) {
if (++cc >= b_columns) break;
cy = 1; cx = (b_width / b_columns) * cc;
}