diff --git a/AvailableColumnsPanel.c b/AvailableColumnsPanel.c index d954da8c521e52dfd1986823e2a38db93fd9454e..6c4b5ef5ac58c11aca03fd51b2915f795808d122 100644 --- a/AvailableColumnsPanel.c +++ b/AvailableColumnsPanel.c @@ -55,7 +55,7 @@ static HandlerResult AvailableColumnsPanel_eventHandler(Panel* super, int ch) { } default: { - if (isalpha(ch)) + if (ch < 255 && isalpha(ch)) result = Panel_selectByTyping(super, ch); break; } diff --git a/CategoriesPanel.c b/CategoriesPanel.c index bf6ee543db276a36c27bf3d98910aff3317804c2..084f48e4cccb3ea0789ea3233e52ec710037bd52 100644 --- a/CategoriesPanel.c +++ b/CategoriesPanel.c @@ -102,7 +102,7 @@ static HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) { break; } default: - if (isalpha(ch)) + if (ch < 255 && isalpha(ch)) result = Panel_selectByTyping(super, ch); if (result == BREAK_LOOP) result = IGNORED; diff --git a/ColumnsPanel.c b/ColumnsPanel.c index f4eed99ee6ffeedbb53cdfac7ebe5bac3d01a96d..844e958002e87bcc2a152ec8d057cc91913d699b 100644 --- a/ColumnsPanel.c +++ b/ColumnsPanel.c @@ -70,7 +70,7 @@ static HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) { } default: { - if (isalpha(ch)) + if (ch < 255 && isalpha(ch)) result = Panel_selectByTyping(super, ch); if (result == BREAK_LOOP) result = IGNORED; diff --git a/IncSet.c b/IncSet.c index 40aa9233a89d266e9d0d5000b958192ea273e7b9..a77616026d8f26d4fda879333193b79b0552ba93 100644 --- a/IncSet.c +++ b/IncSet.c @@ -153,7 +153,7 @@ bool IncSet_handleKey(IncSet* this, int ch, Panel* panel, IncMode_GetPanelValue } } doSearch = false; - } else if (isprint((char)ch) && (mode->index < INCMODE_MAX)) { + } else if (ch < 255 && isprint((char)ch) && (mode->index < INCMODE_MAX)) { mode->buffer[mode->index] = ch; mode->index++; mode->buffer[mode->index] = 0; diff --git a/Panel.c b/Panel.c index 4355b1e2484814a5b38600798fc98a50dff5e504..681e9ca5fbb45fd3dd317067de32acebcf6cd695 100644 --- a/Panel.c +++ b/Panel.c @@ -427,7 +427,7 @@ HandlerResult Panel_selectByTyping(Panel* this, int ch) { if (!this->eventHandlerBuffer) this->eventHandlerBuffer = calloc(100, 1); - if (isalnum(ch)) { + if (ch < 255 && isalnum(ch)) { int len = strlen(this->eventHandlerBuffer); if (len < 99) { this->eventHandlerBuffer[len] = ch; diff --git a/RichString.c b/RichString.c index 51914b08c56202a1dba27218cb56641cb1485891..22ffecb51dcfb80772c5731e15b67482de70a13c 100644 --- a/RichString.c +++ b/RichString.c @@ -128,7 +128,7 @@ static inline void RichString_writeFrom(RichString* this, int attrs, const char* int newLen = from + len; RichString_setLen(this, newLen); for (int i = from, j = 0; i < newLen; i++, j++) - this->chptr[i] = (isprint(data_c[j]) ? data_c[j] : '?') | attrs; + this->chptr[i] = (data_c[j] >= 32 ? data_c[j] : '?') | attrs; this->chptr[newLen] = 0; } diff --git a/htop.c b/htop.c index 281d40ea8eacd51051f229952800a6f51fa692b7..62e49c9c1fe048f1bc0b9d1bb27576ea67a4d4af 100644 --- a/htop.c +++ b/htop.c @@ -852,7 +852,7 @@ int main(int argc, char** argv) { continue; } - if (isdigit((char)ch)) { + if (ch < 255 && isdigit((char)ch)) { if (Panel_size(panel) == 0) continue; pid_t pid = ch-48 + acc; for (int i = 0; i < ProcessList_size(pl); i++) {