From cdd6c984c96fe3437b7584b86b3a50af2c9a85d0 Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Thu, 9 Jan 2025 19:41:36 +0800 Subject: [PATCH] Reflect the "show cached memory" setting in help screen Hide the "buffers/cache" text on the memory bar description when the "show cached memory" setting is off. Signed-off-by: Kang-Che Sung --- Action.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Action.c b/Action.c index 56fb3d0cb..ed61881a8 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], "]");