diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-10-29 15:15:31 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-10-29 15:33:39 +0100 |
commit | 5f0c39134d29b16ce6e864d9ad1a88c959786466 (patch) | |
tree | e5e41b6ece8f89a465fc9112594a6799a167b901 | |
parent | 32743f1e117055de5388eddac65505eef4218aae (diff) | |
download | sciteco-5f0c39134d29b16ce6e864d9ad1a88c959786466.tar.gz |
PDCurses: filter out bogus double keypresses in combination with CTRL (refs #20)
* Has been observed on PDCursesMod/WinGUI when pressing CTRL+Shift+6 on an US layout.
I would expect code 30 (^^) to be inserted, instead PDCurses reports two keypresses (6^^).
The first one is now filtered out since this will not be fixed upstream.
See also https://github.com/Bill-Gray/PDCursesMod/issues/323
* Since AltGr on German layouts is reported as CTRL+ALT, we must be careful not to filter those
out as well.
* This is active on all PDCurses variants - who knows which other platforms will behave similarily.
* You still cannot insert code 0 via CTRL+@ since PDCurses doesn't report it, but ncurses does not allow that either.
This _could_ be synthesized by evaluating the modifier flags, though.
-rw-r--r-- | src/interface-curses/interface.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c index b1fa88b..075c9c7 100644 --- a/src/interface-curses/interface.c +++ b/src/interface-curses/interface.c @@ -1705,6 +1705,18 @@ teco_interface_event_loop_iter(void) /* unhandled function key */ return; +#ifdef __PDCURSES__ + /* + * Especially PDCurses/WinGUI likes to report two keypresses, + * e.g. for CTRL+Shift+6 (CTRL+^). + * Make sure we don't filter out AltGr, which may be reported as CTRL+ALT. + */ + if ((PDC_get_key_modifiers() & + (PDC_KEY_MODIFIER_CONTROL | PDC_KEY_MODIFIER_ALT)) == PDC_KEY_MODIFIER_CONTROL && + !TECO_IS_CTL(key)) + return; +#endif + /* * NOTE: There's also wget_wch(), but it requires * a widechar version of Curses. |