diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-12-30 21:01:54 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-12-30 21:01:54 +0100 |
commit | dc02222f9a633b2f76586a1d4a7d1632d1845b27 (patch) | |
tree | b5eab1d81163588b299f3d2f88ddef5bad23ca16 /src | |
parent | 62c0837cd56e99fbd5364a263d6c7d9ab31714f3 (diff) | |
download | sciteco-dc02222f9a633b2f76586a1d4a7d1632d1845b27.tar.gz |
ncurses: use a default escape delay of 25ms
* this practically fixes the delay issues when using
the escape key since 25ms is too short for humans to notice.
Still it should be large enough for all practical terminal
emulators and transmission speeds to get escape sequences
transmitted.
* If the escape delay turns out to be too short, it can still
be overwritten using the (standard ncurses) $ESCDELAY environment
variable.
* fnkeys.tes will still provide the escape surrogate since the
insert key will often be in a better possition on computer
keyboards.
Diffstat (limited to 'src')
-rw-r--r-- | src/interface-curses.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/interface-curses.cpp b/src/interface-curses.cpp index 93fe923..8c6af7f 100644 --- a/src/interface-curses.cpp +++ b/src/interface-curses.cpp @@ -803,6 +803,26 @@ InterfaceCurses::init_interactive(void) QRegisters::globals.update_environ(); /* + * On UNIX terminals, the escape key is usually + * delivered as the escape character even though function + * keys are delivered as escape sequences as well. + * That's why there has to be a timeout for detecting + * escape presses if function key handling is enabled. + * This timeout can be controlled using $ESCDELAY on + * ncurses but its default is much too long. + * We set it to 25ms as Vim does. In the very rare cases + * this won't suffice, $ESCDELAY can still be set explicitly. + * + * NOTE: The only terminal emulator I'm aware of that lets + * us send an escape sequence for the escape key is Mintty + * (see "\e[?7727h"). + */ +#ifdef NCURSES_UNIX + if (!g_getenv("ESCDELAY")) + set_escdelay(25); +#endif + + /* * $TERM must be unset or "#win32con" for the win32 * driver to load. * So we always ignore any $TERM changes by the user. |