diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-01-10 14:03:15 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2023-01-16 11:26:49 +0100 |
commit | 160c69b655ce2e47fbedcc87fcb4949c2bc04dce (patch) | |
tree | cdbce0fdd0318b8103d1d0278d517072f5bd4d4b /src/nvim/tui/input.c | |
parent | 43feb973e30ed40b8eb7bc97b0f41eef0b51194b (diff) | |
download | rneovim-160c69b655ce2e47fbedcc87fcb4949c2bc04dce.tar.gz rneovim-160c69b655ce2e47fbedcc87fcb4949c2bc04dce.tar.bz2 rneovim-160c69b655ce2e47fbedcc87fcb4949c2bc04dce.zip |
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.
Diffstat (limited to 'src/nvim/tui/input.c')
-rw-r--r-- | src/nvim/tui/input.c | 16 |
1 files changed, 2 insertions, 14 deletions
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); |