Skip to content

Commit 3689f05

Browse files
committed
Dim memory "buffers" and "cache" when they are hidden from bar and graph
1 parent a05175b commit 3689f05

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

MemoryMeter.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ static void MemoryMeter_updateValues(Meter* this) {
6767
static void MemoryMeter_display(const Object* cast, RichString* out) {
6868
char buffer[50];
6969
const Meter* this = (const Meter*)cast;
70+
const Settings* settings = this->host->settings;
7071

7172
RichString_writeAscii(out, CRT_colors[METER_TEXT], ":");
7273
Meter_humanUnit(buffer, this->total, sizeof(buffer));
@@ -91,12 +92,12 @@ static void MemoryMeter_display(const Object* cast, RichString* out) {
9192
}
9293

9394
Meter_humanUnit(buffer, this->values[MEMORY_METER_BUFFERS], sizeof(buffer));
94-
RichString_appendAscii(out, CRT_colors[METER_TEXT], " buffers:");
95-
RichString_appendAscii(out, CRT_colors[MEMORY_BUFFERS_TEXT], buffer);
95+
RichString_appendAscii(out, settings->showCachedMemory ? CRT_colors[METER_TEXT] : CRT_colors[METER_SHADOW], " buffers:");
96+
RichString_appendAscii(out, settings->showCachedMemory ? CRT_colors[MEMORY_BUFFERS_TEXT] : CRT_colors[METER_SHADOW], buffer);
9697

9798
Meter_humanUnit(buffer, this->values[MEMORY_METER_CACHE], sizeof(buffer));
98-
RichString_appendAscii(out, CRT_colors[METER_TEXT], " cache:");
99-
RichString_appendAscii(out, CRT_colors[MEMORY_CACHE], buffer);
99+
RichString_appendAscii(out, settings->showCachedMemory ? CRT_colors[METER_TEXT] : CRT_colors[METER_SHADOW], " cache:");
100+
RichString_appendAscii(out, settings->showCachedMemory ? CRT_colors[MEMORY_CACHE] : CRT_colors[METER_SHADOW], buffer);
100101

101102
/* available memory is not supported on all platforms */
102103
if (isNonnegative(this->values[MEMORY_METER_AVAILABLE])) {

0 commit comments

Comments
 (0)