From 5470fc3a63ff1cb15d7d5128e5c9d682dda28341 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 20 Apr 2023 13:23:39 +0300 Subject: Curses: do not allow typing any non-ASCII characters - fixes crashes on PDCurses/WinGUI * we can neither display, nor parse Unicode characters properly, so this does not worsen anything * makes it harder to confuse the parser as long as we do not support Unicode. * behaves like on Gtk: pressing a non-ASCII char will simply be ignored * Most importantly, this fixes crashes on PDCurses/WinGUI. It apparently couldn't handle the negative integers that resulted from passing a value >= 0x80 <= 0xFF into gchar (which is a signed integer). Changing everything into guchar is not worth the effort - we need full Unicode support anyway. --- src/interface-curses/interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c index ae0cb9a..25311c5 100644 --- a/src/interface-curses/interface.c +++ b/src/interface-curses/interface.c @@ -1626,7 +1626,7 @@ teco_interface_event_loop_iter(void) * Control keys and keys with printable representation */ default: - if (key <= 0xFF && + if (key < 0x80 && !teco_cmdline_keypress_c(key, &teco_interface.event_loop_error)) return; } -- cgit v1.2.3