Process: use correct column aligning on wide username

Closes: #421
This commit is contained in:
Christian Göttsche 2020-12-23 12:21:29 +01:00
parent 94d7f0b585
commit 5359eae28b
1 changed files with 6 additions and 7 deletions

View File

@ -363,15 +363,14 @@ void Process_writeField(const Process* this, RichString* str, ProcessField field
case USER: { case USER: {
if (Process_getuid != this->st_uid) if (Process_getuid != this->st_uid)
attr = CRT_colors[PROCESS_SHADOW]; attr = CRT_colors[PROCESS_SHADOW];
if (this->user) { if (this->user) {
xSnprintf(buffer, n, "%-9s ", this->user); int c = RichString_appendnWide(str, attr, this->user, MINIMUM(9, strlen(this->user)));
} else { RichString_appendChr(str, ' ', 10 - c);
xSnprintf(buffer, n, "%-9d ", this->st_uid); return;
}
if (buffer[9] != '\0') {
buffer[9] = ' ';
buffer[10] = '\0';
} }
xSnprintf(buffer, n, "%-9d ", this->st_uid);
break; break;
} }
default: default: