diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-02-19 17:59:58 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-02-20 09:27:34 -0300 |
commit | bbcddc55ee1e5605657592644be0102ed3a5f104 (patch) | |
tree | ab100efba3d63e1467a6a9768d13e63bb5a3fa55 | |
parent | 20f52f4235760cb4c10a85e5016453598fc0e170 (diff) | |
download | rneovim-bbcddc55ee1e5605657592644be0102ed3a5f104.tar.gz rneovim-bbcddc55ee1e5605657592644be0102ed3a5f104.tar.bz2 rneovim-bbcddc55ee1e5605657592644be0102ed3a5f104.zip |
tui: Replace uv_tty_t by uv_pipe_t
It seems uv_tty_t doesn't work properly on OSX(it is set to blocking mode,
which causes UV_RUN_NOWAIT to misbehave).
-rw-r--r-- | src/nvim/tui/term_input.inl | 7 | ||||
-rw-r--r-- | src/nvim/tui/tui.c | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/tui/term_input.inl b/src/nvim/tui/term_input.inl index 2e94742fa7..6b8e3197ba 100644 --- a/src/nvim/tui/term_input.inl +++ b/src/nvim/tui/term_input.inl @@ -12,7 +12,7 @@ struct term_input { int in_fd; bool paste_enabled; TermKey *tk; - uv_tty_t input_handle; + uv_pipe_t input_handle; uv_timer_t timer_handle; RBuffer *read_buffer; RStream *read_stream; @@ -265,8 +265,8 @@ static TermInput *term_input_new(void) int curflags = termkey_get_canonflags(rv->tk); termkey_set_canonflags(rv->tk, curflags | TERMKEY_CANON_DELBS); // setup input handle - uv_tty_init(uv_default_loop(), &rv->input_handle, rv->in_fd, 1); - uv_tty_set_mode(&rv->input_handle, UV_TTY_MODE_RAW); + uv_pipe_init(uv_default_loop(), &rv->input_handle, 0); + uv_pipe_open(&rv->input_handle, rv->in_fd); rv->input_handle.data = NULL; rv->read_buffer = rbuffer_new(0xfff); rv->read_stream = rstream_new(read_cb, rv->read_buffer, rv); @@ -285,7 +285,6 @@ static TermInput *term_input_new(void) static void term_input_destroy(TermInput *input) { - uv_tty_reset_mode(); uv_timer_stop(&input->timer_handle); rstream_stop(input->read_stream); rstream_free(input->read_stream); diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 57119b9030..ad2005fa2d 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -113,6 +113,7 @@ void tui_start(void) data->write_loop = xmalloc(sizeof(uv_loop_t)); uv_loop_init(data->write_loop); uv_tty_init(data->write_loop, &data->output_handle, data->out_fd, 0); + uv_tty_set_mode(&data->output_handle, UV_TTY_MODE_RAW); // Obtain screen dimensions update_size(ui); @@ -169,6 +170,7 @@ static void tui_stop(UI *ui) // Disable bracketed paste unibi_out(ui, (int)data->unibi_ext.disable_bracketed_paste); flush_buf(ui); + uv_tty_reset_mode(); uv_close((uv_handle_t *)&data->output_handle, NULL); uv_run(data->write_loop, UV_RUN_DEFAULT); if (uv_loop_close(data->write_loop)) { |