From b4408559c1e6e0df3ce61a198f9a4d1f444ecb87 Mon Sep 17 00:00:00 2001 From: rillig Date: Sun, 21 Feb 2021 16:37:26 +0000 Subject: cgram: fix undefined behavior when pressing function keys The key codes for function keys are outside of the "range representable by an unsigned char". This resulted in parts of the screen being cleaned. --- cgram/cgram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cgram/cgram.c b/cgram/cgram.c index 7eaf592d..98f8bece 100644 --- a/cgram/cgram.c +++ b/cgram/cgram.c @@ -325,7 +325,7 @@ loop(void) done = true; break; default: - if (isalpha(ch)) { + if (isascii(ch) && isalpha(ch)) { if (substitute(ch)) { if (curx < strlen(lines.v[cury])) { curx++; -- cgit v1.2.3-56-ge451