Merge pull request #454 from Superty/main

proc tree: fix display bug when displaying full cmd
This commit is contained in:
Jakob P. Liljenberg 2022-10-31 22:54:12 +01:00 committed by GitHub
commit 3ddf89ae1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1473,9 +1473,12 @@ namespace Proc {
out += c_color + uresize(p.name, width_left - 1) + end + ' ';
width_left -= (ulen(p.name) + 1);
}
if (width_left > 30 || (width_left > 7 && p.short_cmd != p.name)) {
out += g_color + '(' + uresize(width_left > 30 ? p.cmd : p.short_cmd, width_left - 3, p_wide_cmd[p.pid]) + ") ";
width_left -= (ulen(p.short_cmd, true) + 3);
if (width_left > 7) {
const string& cmd = width_left > 40 ? rtrim(p.cmd) : p.short_cmd;
if (not cmd.empty() and cmd != p.name) {
out += g_color + '(' + uresize(cmd, width_left - 3, p_wide_cmd[p.pid]) + ") ";
width_left -= (ulen(cmd, true) + 3);
}
}
out += string(max(0, width_left), ' ') + Mv::to(y+2+lc, x+2+tree_size);
}