aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/input.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-01-10 14:03:15 +0100
committerbfredl <bjorn.linse@gmail.com>2023-01-16 11:26:49 +0100
commit160c69b655ce2e47fbedcc87fcb4949c2bc04dce (patch)
treecdbce0fdd0318b8103d1d0278d517072f5bd4d4b /src/nvim/os/input.c
parent43feb973e30ed40b8eb7bc97b0f41eef0b51194b (diff)
downloadrneovim-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/os/input.c')
-rw-r--r--src/nvim/os/input.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index 5d2ac1e102..51cabfbcbf 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -44,7 +44,6 @@ typedef enum {
static Stream read_stream = { .closed = true }; // Input before UI starts.
static RBuffer *input_buffer = NULL;
static bool input_eof = false;
-static int global_fd = -1;
static bool blocking = false;
static int cursorhold_time = 0; ///< time waiting for CursorHold event
static int cursorhold_tb_change_cnt = 0; ///< tb_change_cnt when waiting started
@@ -58,25 +57,14 @@ void input_init(void)
input_buffer = rbuffer_new(INPUT_BUFFER_SIZE + MAX_KEY_CODE_LEN);
}
-void input_global_fd_init(int fd)
-{
- global_fd = fd;
-}
-
-/// Global TTY (or pipe for "-es") input stream, before UI starts.
-int input_global_fd(void)
-{
- return global_fd;
-}
-
-void input_start(int fd)
+void input_start(void)
{
if (!read_stream.closed) {
return;
}
- input_global_fd_init(fd);
- rstream_init_fd(&main_loop, &read_stream, fd, READ_BUFFER_SIZE);
+ used_stdin = true;
+ rstream_init_fd(&main_loop, &read_stream, STDIN_FILENO, READ_BUFFER_SIZE);
rstream_start(&read_stream, input_read_cb, NULL);
}