mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(tui): piping nodejs to nvim breaks input handling #18932
Problem:
Piping NodeJS output into Neovim makes the editor unusable.
This happens because NodeJS changes the tty state on exit after
Nvim calls uv_tty_set_mode(). (May not always happen due to race
condition.)
This should have been fixed by 4ba5b4a864
#13084. But some
commands and functions (:sleep, system(), …) call ui_flush()
internally, in particular the first tui_mode_change() is called before
the end of startup.
Steps to reproduce:
1. node -e "setTimeout(()=>{console.log('test')}, 1000)" | nvim -u NORC +"sleep 500m" -
2. The cursor key letters just overwrite the editor screen, and CTRL+C exits.
Solution:
Skip pending_mode_update during startup.
Note: Delaying ui_flush() entirely could be a more general solution
(emit a new UI event on VimEnter?). But "remote/coprocess TUI" #18375
could make all of this moot anyway.
Fixes #18470
This commit is contained in:
parent
c5c5d980a1
commit
837ea6da9f
@ -514,7 +514,7 @@ void ui_flush(void)
|
||||
api_free_array(style);
|
||||
pending_mode_info_update = false;
|
||||
}
|
||||
if (pending_mode_update) {
|
||||
if (pending_mode_update && !starting) {
|
||||
char *full_name = shape_table[ui_mode_idx].full_name;
|
||||
ui_call_mode_change(cstr_as_string(full_name), ui_mode_idx);
|
||||
pending_mode_update = false;
|
||||
|
Loading…
Reference in New Issue
Block a user