From 8c99683b04ca38e98b1405d63a8c83f890e05ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ko=C5=84czak?= Date: Wed, 5 Jan 2022 14:27:51 +0100 Subject: Fix custom thread name display issue Fixes #877 --- Process.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Process.c') diff --git a/Process.c b/Process.c index 3f0da978..89ccaf27 100644 --- a/Process.c +++ b/Process.c @@ -417,7 +417,7 @@ void Process_makeCommandStr(Process* this) { return; if (this->state == ZOMBIE && !this->mergedCommand.str) return; - if (Process_isUserlandThread(this) && settings->showThreadNames && (showThreadNames == mc->prevShowThreadNames)) + if (Process_isUserlandThread(this) && settings->showThreadNames && (showThreadNames == mc->prevShowThreadNames) && (mc->prevMergeSet == showMergedCommand)) return; /* this->mergedCommand.str needs updating only if its state or contents changed. @@ -516,11 +516,14 @@ void Process_makeCommandStr(Process* this) { assert(cmdlineBasenameStart <= (int)strlen(cmdline)); if (!showMergedCommand || !procExe || !procComm) { /* fall back to cmdline */ - if (showMergedCommand && (!Process_isUserlandThread(this) || showThreadNames) && !procExe && procComm && strlen(procComm)) { /* Prefix column with comm */ + if ((showMergedCommand || (Process_isUserlandThread(this) && showThreadNames)) && procComm && strlen(procComm)) { /* set column to or prefix it with comm */ if (strncmp(cmdline + cmdlineBasenameStart, procComm, MINIMUM(TASK_COMM_LEN - 1, strlen(procComm))) != 0) { WRITE_HIGHLIGHT(0, strlen(procComm), commAttr, CMDLINE_HIGHLIGHT_FLAG_COMM); str = stpcpy(str, procComm); + if(!showMergedCommand) + return; + WRITE_SEPARATOR; } } -- cgit v1.2.3