Reduce code duplication for nearly identical code-paths

This commit is contained in:
Benny Baumann 2021-05-15 21:55:14 +02:00 committed by BenBE
parent 9a78155e17
commit 2824e2989a
1 changed files with 3 additions and 7 deletions

View File

@ -499,13 +499,9 @@ void Process_makeCommandStr(Process *this) {
}
}
if (showProgramPath) {
WRITE_HIGHLIGHT(cmdlineBasenameStart, cmdlineBasenameEnd - cmdlineBasenameStart, baseAttr, CMDLINE_HIGHLIGHT_FLAG_BASENAME);
(void)stpcpyWithNewlineConversion(str, cmdline);
} else {
WRITE_HIGHLIGHT(0, cmdlineBasenameEnd - cmdlineBasenameStart, baseAttr, CMDLINE_HIGHLIGHT_FLAG_BASENAME);
(void)stpcpyWithNewlineConversion(str, cmdline + cmdlineBasenameStart);
}
if (cmdlineBasenameEnd > cmdlineBasenameStart)
WRITE_HIGHLIGHT(showProgramPath ? cmdlineBasenameStart : 0, cmdlineBasenameEnd - cmdlineBasenameStart, baseAttr, CMDLINE_HIGHLIGHT_FLAG_BASENAME);
(void)stpcpyWithNewlineConversion(str, cmdline + (showProgramPath ? 0 : cmdlineBasenameStart));
return;
}