aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnciety <anciety@pku.edu.cn>2019-08-18 11:58:35 +0800
committerJustin M. Keyes <justinkz@gmail.com>2019-08-20 20:14:13 +0200
commite097e4704b8b4fd8c8ec659a6e9cc83cb500cfc3 (patch)
treeb980ecb8b665dbb30c20c531edeb9c188513798d
parent7ed21226224276627f43178ebfe6a3a0330006c8 (diff)
downloadrneovim-e097e4704b8b4fd8c8ec659a6e9cc83cb500cfc3.tar.gz
rneovim-e097e4704b8b4fd8c8ec659a6e9cc83cb500cfc3.tar.bz2
rneovim-e097e4704b8b4fd8c8ec659a6e9cc83cb500cfc3.zip
win: stream: reset tty stream on close
This was overlooked in 8072f085d2ed. Analogous to 8a782f1699e2. fix #10668 ref 8072f085d2ed #9884 ref 8a782f1699e2 #2377
-rw-r--r--src/nvim/event/stream.c7
-rw-r--r--test/functional/fixtures/tty-test.c3
2 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c
index 7c8014dead..d1a53fa4b6 100644
--- a/src/nvim/event/stream.c
+++ b/src/nvim/event/stream.c
@@ -97,6 +97,13 @@ void stream_close(Stream *stream, stream_close_cb on_stream_close, void *data)
stream->close_cb = on_stream_close;
stream->close_cb_data = data;
+#ifdef WIN32
+ if (UV_TTY == uv_guess_handle(stream->fd)) {
+ // Undo UV_TTY_MODE_RAW from stream_init(). #10801
+ uv_tty_set_mode(&stream->uv.tty, UV_TTY_MODE_NORMAL);
+ }
+#endif
+
if (!stream->pending_reqs) {
stream_close_handle(stream);
}
diff --git a/test/functional/fixtures/tty-test.c b/test/functional/fixtures/tty-test.c
index e2a78a594b..4438b73a22 100644
--- a/test/functional/fixtures/tty-test.c
+++ b/test/functional/fixtures/tty-test.c
@@ -38,6 +38,9 @@ bool owns_tty(void)
static void walk_cb(uv_handle_t *handle, void *arg)
{
if (!uv_is_closing(handle)) {
+#ifdef WIN32
+ uv_tty_set_mode(&tty, UV_TTY_MODE_NORMAL);
+#endif
uv_close(handle, NULL);
}
}