mirror of https://github.com/xzeldon/htop.git
Fix header layout and meters reset if a header column is empty
Closes #880 Patch from BenBE and cgzones
This commit is contained in:
parent
a2ca7583a9
commit
0ffd772d28
11
Settings.c
11
Settings.c
|
@ -111,14 +111,21 @@ static void Settings_readMeterModes(Settings* this, const char* line, unsigned i
|
||||||
static bool Settings_validateMeters(Settings* this) {
|
static bool Settings_validateMeters(Settings* this) {
|
||||||
const size_t colCount = HeaderLayout_getColumns(this->hLayout);
|
const size_t colCount = HeaderLayout_getColumns(this->hLayout);
|
||||||
|
|
||||||
|
bool anyMeter = false;
|
||||||
|
|
||||||
for (size_t column = 0; column < colCount; column++) {
|
for (size_t column = 0; column < colCount; column++) {
|
||||||
char** names = this->hColumns[column].names;
|
char** names = this->hColumns[column].names;
|
||||||
const int* modes = this->hColumns[column].modes;
|
const int* modes = this->hColumns[column].modes;
|
||||||
const size_t len = this->hColumns[column].len;
|
const size_t len = this->hColumns[column].len;
|
||||||
|
|
||||||
if (!names || !modes || !len)
|
if (!len)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!names || !modes)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
anyMeter |= !!len;
|
||||||
|
|
||||||
// Check for each mode there is an entry with a non-NULL name
|
// Check for each mode there is an entry with a non-NULL name
|
||||||
for (size_t meterIdx = 0; meterIdx < len; meterIdx++)
|
for (size_t meterIdx = 0; meterIdx < len; meterIdx++)
|
||||||
if (!names[meterIdx])
|
if (!names[meterIdx])
|
||||||
|
@ -128,7 +135,7 @@ static bool Settings_validateMeters(Settings* this) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return anyMeter;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Settings_defaultMeters(Settings* this, unsigned int initialCpuCount) {
|
static void Settings_defaultMeters(Settings* this, unsigned int initialCpuCount) {
|
||||||
|
|
Loading…
Reference in New Issue