htop/htop-non-printable-characters.patch

18 lines
637 B
Diff

Index: htop-0.8.1/RichString.c
===================================================================
--- htop-0.8.1.orig/RichString.c
+++ htop-0.8.1/RichString.c
@@ -56,11 +56,11 @@ inline void RichString_appendn(RichStrin
if (len<0)
return;
int last = MIN(RICHSTRING_MAXLEN - 1, len + this->len);
for (int i = this->len, j = 0; i < last; i++, j++) {
memset(&this->chstr[i], 0, sizeof(this->chstr[i]));
- this->chstr[i].chars[0] = data[j];
+ this->chstr[i].chars[0] = (data[j] > 31) ? data[j] : '?';
this->chstr[i].attr = attrs;
}
this->chstr[last].chars[0] = 0;
this->len = last;
}