Fixed missing CPU core temps when too small to show core temp graphs, issues #792 #867

This commit is contained in:
aristocratos 2024-06-01 14:09:49 +02:00
parent 97d2fb567a
commit 3f384c0a5d

View file

@ -824,10 +824,10 @@ namespace Cpu {
out += Theme::g("cpu").at(clamp(safeVal(cpu.core_percent, n).back(), 0ll, 100ll));
out += rjust(to_string(safeVal(cpu.core_percent, n).back()), (b_column_size < 2 ? 3 : 4)) + Theme::c("main_fg") + '%';
if (show_temps and not hide_cores and std::cmp_greater_equal(temp_graphs.size(), n)) {
if (show_temps and not hide_cores) {
const auto [temp, unit] = celsius_to(safeVal(cpu.temp, n+1).back(), temp_scale);
const auto& temp_color = Theme::g("temp").at(clamp(safeVal(cpu.temp, n+1).back() * 100 / cpu.temp_max, 0ll, 100ll));
if (b_column_size > 1)
if (b_column_size > 1 and std::cmp_greater_equal(temp_graphs.size(), n))
out += ' ' + Theme::c("inactive_fg") + graph_bg * 5 + Mv::l(5)
+ temp_graphs.at(n+1)(safeVal(cpu.temp, n+1), data_same or redraw);
out += temp_color + rjust(to_string(temp), 4) + Theme::c("main_fg") + unit;