diff options
author | 林千里 <lincheney@gmail.com> | 2018-06-06 14:36:19 +1000 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-06-08 02:18:27 +0200 |
commit | 451c48a0926540fe42a307d222c733210551b1d0 (patch) | |
tree | 5dd7f587cb17bcda8647b792aea44c87caedc608 /src | |
parent | db68d1d638e4986f7557877ea511e11990b5f4a3 (diff) | |
download | rneovim-451c48a0926540fe42a307d222c733210551b1d0.tar.gz rneovim-451c48a0926540fe42a307d222c733210551b1d0.tar.bz2 rneovim-451c48a0926540fe42a307d222c733210551b1d0.zip |
terminal: flush vterm output buffer on pty output #8486
Fixes #4151
libvterm uses an "output buffer" for terminal reporting
(e.g. \e[6n to report cursor position)
Flush it in on_channel_output() not just terminal_send_key()
See also this line from pangoterm:
https://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/607/pangoterm.c#L2159
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/channel.c | 1 | ||||
-rw-r--r-- | src/nvim/terminal.c | 13 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/nvim/channel.c b/src/nvim/channel.c index 64d743891b..6ad64bbb85 100644 --- a/src/nvim/channel.c +++ b/src/nvim/channel.c @@ -602,6 +602,7 @@ static void on_channel_output(Stream *stream, Channel *chan, RBuffer *buf, // process_channel_event will modify the read buffer(convert NULs into NLs) if (chan->term) { terminal_receive(chan->term, ptr, count); + terminal_flush_output(chan->term); } rbuffer_consumed(buf, count); diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 39cb2b6372..7f1bff75b4 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -528,6 +528,13 @@ void terminal_send(Terminal *term, char *data, size_t size) term->opts.write_cb(data, size, term->opts.data); } +void terminal_flush_output(Terminal *term) +{ + size_t len = vterm_output_read(term->vt, term->textbuf, + sizeof(term->textbuf)); + terminal_send(term, term->textbuf, len); +} + void terminal_send_key(Terminal *term, int c) { VTermModifier mod = VTERM_MOD_NONE; @@ -545,9 +552,7 @@ void terminal_send_key(Terminal *term, int c) vterm_keyboard_unichar(term->vt, (uint32_t)c, mod); } - size_t len = vterm_output_read(term->vt, term->textbuf, - sizeof(term->textbuf)); - terminal_send(term, term->textbuf, (size_t)len); + terminal_flush_output(term); } void terminal_receive(Terminal *term, char *data, size_t len) @@ -982,7 +987,7 @@ static bool send_mouse_event(Terminal *term, int c) mouse_action(term, button, row, col, drag, 0); size_t len = vterm_output_read(term->vt, term->textbuf, - sizeof(term->textbuf)); + sizeof(term->textbuf)); terminal_send(term, term->textbuf, (size_t)len); return false; } |