diff --git a/Action.c b/Action.c index 56fb3d0cb..986b35463 100644 --- a/Action.c +++ b/Action.c @@ -744,9 +744,13 @@ static Htop_Reaction actionHelp(State* st) { addbartext(CRT_colors[MEMORY_USED], "", "used"); addbartext(CRT_colors[MEMORY_SHARED], "/", "shared"); addbartext(CRT_colors[MEMORY_COMPRESSED], "/", "compressed"); - addbartext(CRT_colors[MEMORY_BUFFERS_TEXT], "/", "buffers"); - addbartext(CRT_colors[MEMORY_CACHE], "/", "cache"); - addbartext(CRT_colors[BAR_SHADOW], " ", "used"); + if (st->host->settings->showCachedMemory) { + addbartext(CRT_colors[MEMORY_BUFFERS_TEXT], "/", "buffers"); + addbartext(CRT_colors[MEMORY_CACHE], "/", "cache"); + addbartext(CRT_colors[BAR_SHADOW], " ", "used"); + } else { + addbartext(CRT_colors[BAR_SHADOW], " ", "used"); + } addbartext(CRT_colors[BAR_SHADOW], "/", "total"); addattrstr(CRT_colors[BAR_BORDER], "]"); @@ -758,7 +762,7 @@ static Htop_Reaction actionHelp(State* st) { addbartext(CRT_colors[SWAP_CACHE], "/", "cache"); addbartext(CRT_colors[SWAP_FRONTSWAP], "/", "frontswap"); #else - addbartext(CRT_colors[SWAP_CACHE], " ", ""); + addbartext(CRT_colors[BAR_SHADOW], " ", ""); #endif addbartext(CRT_colors[BAR_SHADOW], " ", "used"); addbartext(CRT_colors[BAR_SHADOW], "/", "total"); diff --git a/MemoryMeter.c b/MemoryMeter.c index 36401cb79..6769e3bec 100644 --- a/MemoryMeter.c +++ b/MemoryMeter.c @@ -67,6 +67,7 @@ static void MemoryMeter_updateValues(Meter* this) { static void MemoryMeter_display(const Object* cast, RichString* out) { char buffer[50]; const Meter* this = (const Meter*)cast; + const Settings* settings = this->host->settings; RichString_writeAscii(out, CRT_colors[METER_TEXT], ":"); Meter_humanUnit(buffer, this->total, sizeof(buffer)); @@ -91,12 +92,12 @@ static void MemoryMeter_display(const Object* cast, RichString* out) { } Meter_humanUnit(buffer, this->values[MEMORY_METER_BUFFERS], sizeof(buffer)); - RichString_appendAscii(out, CRT_colors[METER_TEXT], " buffers:"); - RichString_appendAscii(out, CRT_colors[MEMORY_BUFFERS_TEXT], buffer); + RichString_appendAscii(out, settings->showCachedMemory ? CRT_colors[METER_TEXT] : CRT_colors[METER_SHADOW], " buffers:"); + RichString_appendAscii(out, settings->showCachedMemory ? CRT_colors[MEMORY_BUFFERS_TEXT] : CRT_colors[METER_SHADOW], buffer); Meter_humanUnit(buffer, this->values[MEMORY_METER_CACHE], sizeof(buffer)); - RichString_appendAscii(out, CRT_colors[METER_TEXT], " cache:"); - RichString_appendAscii(out, CRT_colors[MEMORY_CACHE], buffer); + RichString_appendAscii(out, settings->showCachedMemory ? CRT_colors[METER_TEXT] : CRT_colors[METER_SHADOW], " cache:"); + RichString_appendAscii(out, settings->showCachedMemory ? CRT_colors[MEMORY_CACHE] : CRT_colors[METER_SHADOW], buffer); /* available memory is not supported on all platforms */ if (isNonnegative(this->values[MEMORY_METER_AVAILABLE])) {