diff options
author | erw7 <erw7.github@gmail.com> | 2020-10-11 10:59:44 +0900 |
---|---|---|
committer | erw7 <erw7.github@gmail.com> | 2020-10-12 10:11:47 +0900 |
commit | 3a597cb1a0c28480b8bf468339152252bcdf2c11 (patch) | |
tree | 50e972a5261140f4fb322050c12f01690821d8fd /src | |
parent | f7cc3ae0b7b8ce67294c00729d278362ad60a4f0 (diff) | |
download | rneovim-3a597cb1a0c28480b8bf468339152252bcdf2c11.tar.gz rneovim-3a597cb1a0c28480b8bf468339152252bcdf2c11.tar.bz2 rneovim-3a597cb1a0c28480b8bf468339152252bcdf2c11.zip |
tui: fix problem that TTY does not go into raw mode
fixes #13073.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/tui/tui.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 2ef9bf5a2e..3158aa0589 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -1102,6 +1102,15 @@ static void tui_set_mode(UI *ui, ModeShape mode) static void tui_mode_change(UI *ui, String mode, Integer mode_idx) { TUIData *data = ui->data; +#ifdef UNIX + // If stdin is not a TTY, the LHS of pipe may change the state of the TTY + // after calling uv_tty_set_mode. So, set the mode of the TTY again here. + // #13073 + if (data->is_starting && data->input.in_fd == STDERR_FILENO) { + uv_tty_set_mode(&data->output_handle.tty, UV_TTY_MODE_NORMAL); + uv_tty_set_mode(&data->output_handle.tty, UV_TTY_MODE_IO); + } +#endif tui_set_mode(ui, (ModeShape)mode_idx); data->is_starting = false; // mode entered, no longer starting data->showing_mode = (ModeShape)mode_idx; |