diff options
author | erw7 <erw7.github@gmail.com> | 2020-02-02 11:38:56 +0900 |
---|---|---|
committer | erw7 <erw7.github@gmail.com> | 2020-05-26 14:13:26 +0900 |
commit | 29f1e1995da1c3e6fb94a5f939c43481df3a500d (patch) | |
tree | 8d3489e98a5ae8c4e68016940fd85af0df827f17 | |
parent | 8c588246a505e4fcd3d28e6d1f670e834c918529 (diff) | |
download | rneovim-29f1e1995da1c3e6fb94a5f939c43481df3a500d.tar.gz rneovim-29f1e1995da1c3e6fb94a5f939c43481df3a500d.tar.bz2 rneovim-29f1e1995da1c3e6fb94a5f939c43481df3a500d.zip |
win: use virtual terminal input (VTI) if available #11803
fixes #9514
fixes #11773
-rw-r--r-- | src/nvim/event/stream.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c index 0e87f7c6c1..8faf5d2a8c 100644 --- a/src/nvim/event/stream.c +++ b/src/nvim/event/stream.c @@ -21,6 +21,10 @@ #define uv_stream_get_write_queue_size(stream) stream->write_queue_size #endif +#ifndef ENABLE_VIRTUAL_TERMINAL_INPUT +# define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200 +#endif + /// Sets the stream associated with `fd` to "blocking" mode. /// /// @return `0` on success, or libuv error code on failure. @@ -62,6 +66,11 @@ void stream_init(Loop *loop, Stream *stream, int fd, uv_stream_t *uvstream) if (type == UV_TTY) { uv_tty_init(&loop->uv, &stream->uv.tty, fd, 0); uv_tty_set_mode(&stream->uv.tty, UV_TTY_MODE_RAW); + DWORD dwMode; + if (GetConsoleMode(stream->uv.tty.handle, &dwMode)) { + dwMode |= ENABLE_VIRTUAL_TERMINAL_INPUT; + SetConsoleMode(stream->uv.tty.handle, dwMode); + } stream->uvstream = STRUCT_CAST(uv_stream_t, &stream->uv.tty); } else { #endif |