mirror of https://github.com/xzeldon/htop.git
fix column shift on wrong megabytes format
see http://0xff.me/htop_bug.png
This commit is contained in:
parent
76a715ee8c
commit
7afda7f5a1
|
@ -294,11 +294,14 @@ void Process_getMaxPid() {
|
||||||
#define ONE_M (ONE_K * ONE_K)
|
#define ONE_M (ONE_K * ONE_K)
|
||||||
#define ONE_G (ONE_M * ONE_K)
|
#define ONE_G (ONE_M * ONE_K)
|
||||||
|
|
||||||
|
#define ONE_DECIMAL_K 1000
|
||||||
|
#define ONE_DECIMAL_M (ONE_DECIMAL_K * ONE_DECIMAL_K)
|
||||||
|
|
||||||
static void Process_humanNumber(Process* this, RichString* str, unsigned long number) {
|
static void Process_humanNumber(Process* this, RichString* str, unsigned long number) {
|
||||||
char buffer[11];
|
char buffer[11];
|
||||||
int len;
|
int len;
|
||||||
if(number >= (10 * ONE_M)) {
|
if(number >= (10 * ONE_DECIMAL_M)) {
|
||||||
if(number >= (100 * ONE_M)) {
|
if(number >= (100 * ONE_DECIMAL_M)) {
|
||||||
len = snprintf(buffer, 10, "%4ldG ", number / ONE_M);
|
len = snprintf(buffer, 10, "%4ldG ", number / ONE_M);
|
||||||
RichString_appendn(str, CRT_colors[LARGE_NUMBER], buffer, len);
|
RichString_appendn(str, CRT_colors[LARGE_NUMBER], buffer, len);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue