mirror of
https://github.com/aristocratos/btop.git
synced 2024-10-31 21:01:03 +01:00
Minor string initialization improvement
This commit is contained in:
parent
1f72e56c7d
commit
19dbbe1a17
@ -1532,12 +1532,13 @@ namespace Proc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Shorten process thread representation when larger than 5 digits: 10000 -> 10K ...
|
// Shorten process thread representation when larger than 5 digits: 10000 -> 10K ...
|
||||||
std::string proc_threads_string;
|
const std::string proc_threads_string = [&] {
|
||||||
if (p.threads > 9999) {
|
if (p.threads > 9999) {
|
||||||
proc_threads_string = std::to_string(p.threads / 1000) + 'K';
|
return std::to_string(p.threads / 1000) + 'K';
|
||||||
} else {
|
} else {
|
||||||
proc_threads_string = std::to_string(p.threads);
|
return std::to_string(p.threads);
|
||||||
}
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
out += (thread_size > 0 ? t_color + rjust(proc_threads_string, thread_size) + ' ' + end : "" )
|
out += (thread_size > 0 ? t_color + rjust(proc_threads_string, thread_size) + ' ' + end : "" )
|
||||||
+ g_color + ljust((cmp_greater(p.user.size(), user_size) ? p.user.substr(0, user_size - 1) + '+' : p.user), user_size) + ' '
|
+ g_color + ljust((cmp_greater(p.user.size(), user_size) ? p.user.substr(0, user_size - 1) + '+' : p.user), user_size) + ' '
|
||||||
|
Loading…
Reference in New Issue
Block a user