mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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).
This commit is contained in:
parent
20f52f4235
commit
bbcddc55ee
@ -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);
|
||||
|
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user