* Explicitly call the Unicode versions of various APIs
* Add const in a couple of places
* Improve a few assert error messages
* Either initialize BackgroundDesktop fully or leave all its fields NULL
* winpty-agent: Respect the ENABLE_QUICK_EDIT_MODE flag. If it's set,
then mouse events are not generated (because they're supposed to control
selection).
* winpty-agent: Because of the above, turn ENABLE_QUICK_EDIT_MODE off at
startup.
* winpty-agent --show-input: Enable ENABLE_WINDOW_INPUT so we can see
buffer resize events.
* winpty-agent --show-input: Disable ENABLE_QUICK_EDIT_MODE with
--with-mouse. When Quick Edit mode is enabled, the mouse controls
selection and does not produce mouse events in the input queue.
Details:
* Rename --showkey to --show-input and dump everything *except* mouse
input.
* Add a mode, --show-input --with-mouse, that also dumps the mouse
input.
Now that the InputHandler thread blocks with select, in addition to the
main thread that also blocks with select, winpty has hit a bug in the
original MSYS where select returns EAGAIN. select is not supposed to fail
with that error (EAGAIN doesn't make much sense as a select error). Add
a workaround just for the original MSYS.
Explicitly shut down the I/O handling threads before restoring the terminal
state. Start calling winpty_close.
This change doesn't fix any bug, AFAIK. It's nice to test/demonstrate the
use of winpty_close.
The InputHandler now uses select to wait on both the blocking stdin tty and
a wakeup fd. This is the same behavior I saw in OpenSSH. OpenSSH sets
its select FDs to O_NONBLOCK *except* FDs for which isatty returns true.
It puts tty FDs into raw mode, but it does not set VMIN/VTIME to 0/0, so
the terminal driver blocks. (In any case, I tested the 0/0 values, and
IIRC they prevented blocking only with a Cygwin emulated pty -- console FDs
in Cygwin blocked; as did both consoles and emulated ptys in the original,
old MSYS. O_NONBLOCK prevented blocking in all cases, though.)
Terminals output these codes under various circumstances:
* rxvt-unicode: numpad, hold down SHIFT
* rxvt: numpad, by default
* xterm: numpad, after enabling app-mode using DECPAM (`ESC =`). xterm
generates `ESC O <mod> <letter>` for modified numpad presses,
necessitating kBareMod.
* mintty: by combining Ctrl with various keys such as '1' or ','.
Handling those keys is difficult, because mintty is generating the
same sequence for Ctrl-1 and Ctrl-NumPadEnd -- should the virtualKey
be '1' or VK_HOME?
The intent is to make it easier to determine how Windows creates KEY_EVENT
records. The code lives in winpty-agent because (1) it's very small, and
(2) I can't test all the interesting keyboards/locales/etc, so if
someone hits a bug, placing it in winpty-agent.exe ensures that they'll
have access to the tools needed to debug it.
* I don't anticipate caring about this, but in principle, there's nothing
wrong with a NUL character in the input map, so fix this while the code
is fresh in my mind.
* Remove these characters from the input map and handle them via the
ordinary <Char> and Alt-<Char> code paths.
* Refactor lookupKey to remove the isEof parameter.
* Ctrl-2 (^@) is encoded as a NUL byte.
* Instead of looking for a NUL byte, we need to check the input size.
Places affected: scanKeyPress, matchDsr, lookupKey
* N.B.: putty and rxvt encode Ctrl-Alt-2 as `ESC NUL`.
Previously, after inputting a NUL using Ctrl-2, one could type an arbitrary
amount of input into the input buffer, and winpty wouldn't do anything
until 1-second inactivity timeout had expired. (i.e. It thought it was
seeing an incomplete DSR, so it kept waiting for the DSR to complete.)
* ^[O is Shift-Alt-O, not Alt-O. Alt-O is ^[o
* '[' is not a valid virtualkey. It's typically VK_OEM_4 on a US
keyboard, but it needs to be looked up dynamically.
* The unicodeChar fields should be 'O' and '[', not NUL.
* Add a --showkey argument to the unix adapter.
My Ubuntu machine has a nice showkey -a utility that dumps keys, but I
can't find something similar for Cygwin/MSYS. It's a very useful tool
for debugging UNIX terminal interoperability, so add it to the unix
adapter.
* Add WINPTY_DEBUG=input to log input bytes and console key events.
* Remove GIT_REVPARSE_WORKS, which is never used
* Rename the shell variables {UNIX,MINGW}_GPP to {UNIX,MINGW}_CXX to
match the config.mk variable names.