From 2a3eda27b3997e9ee4518be659dacee4e91c9099 Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Sat, 11 Jan 2025 05:31:50 +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 a93c64819..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], "]");