aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2023-04-20 13:23:39 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2023-04-20 13:23:39 +0300
commit5470fc3a63ff1cb15d7d5128e5c9d682dda28341 (patch)
tree4b83027723d9282654ee1df31d1caf5a0baf074e
parent54850d4c762f1c44f2dad34b0d01b33a4d881e7f (diff)
downloadsciteco-5470fc3a63ff1cb15d7d5128e5c9d682dda28341.tar.gz
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.
-rw-r--r--src/interface-curses/interface.c2
1 files changed, 1 insertions, 1 deletions
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;
}