From 160c69b655ce2e47fbedcc87fcb4949c2bc04dce Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 10 Jan 2023 14:03:15 +0100 Subject: fix(ui): re-organize tty fd handling and fix issues - Use the correct fd to replace stdin on windows (CONIN) - Don't start the TUI if there are no tty fd (not a regression, but makes sense regardless) - De-mythologize "global input fd". it is just STDIN. --- src/nvim/tui/input.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/nvim/tui/input.c') diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index b837a380d5..91fbdf7886 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -153,19 +153,7 @@ void tinput_init(TermInput *input, Loop *loop) kitty_key_map_entry[i].name); } - // If stdin is not a pty, switch to stderr. For cases like: - // echo q | nvim -es - // ls *.md | xargs nvim -#ifdef MSWIN - if (!os_isatty(input->in_fd)) { - input->in_fd = os_get_conin_fd(); - } -#else - if (!os_isatty(input->in_fd) && os_isatty(STDERR_FILENO)) { - input->in_fd = STDERR_FILENO; - } -#endif - input_global_fd_init(input->in_fd); + input->in_fd = STDIN_FILENO; const char *term = os_getenv("TERM"); if (!term) { @@ -174,7 +162,7 @@ void tinput_init(TermInput *input, Loop *loop) input->tk = termkey_new_abstract(term, TERMKEY_FLAG_UTF8 | TERMKEY_FLAG_NOSTART); - termkey_hook_terminfo_getstr(input->tk, input->tk_ti_hook_fn, NULL); + termkey_hook_terminfo_getstr(input->tk, input->tk_ti_hook_fn, input); termkey_start(input->tk); int curflags = termkey_get_canonflags(input->tk); -- cgit