Header: do not let multi-column meters expand to empty neighbors

Extending to right neighbors is intended for text meters with an
overlong content, so the whole text is shown if possible.
Multi column meters, like the combined memory and swap meter, position
its text depending on the given total width; keep the position to the
original assigned header slot.

Short term resolution for #796
This commit is contained in:
Christian Göttsche
2021-09-18 15:37:20 +02:00
parent 5000cefc13
commit bdb015ffa3
4 changed files with 18 additions and 1 deletions

View File

@ -212,7 +212,10 @@ void Header_draw(const Header* this) {
Meter* meter = (Meter*) Vector_get(meters, i);
float actualWidth = colWidth;
if (meter->mode == TEXT_METERMODE) {
/* Let meters in text mode expand to the right on empty neighbors;
except for multi column meters. */
if (meter->mode == TEXT_METERMODE && !Meter_isMultiColumn(meter)) {
for (int j = 1; j < meter->columnWidthCount; j++) {
actualWidth += (float)width * HeaderLayout_layouts[this->headerLayout].widths[col + j] / 100.0F;
}