aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-02-19 08:27:40 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-02-20 09:27:34 -0300
commit20f52f4235760cb4c10a85e5016453598fc0e170 (patch)
tree27d3ac328c46718826312c4e60cf37e5293a8922
parent8efb3607a7f6cefce450953c7f8d5e3299347bae (diff)
downloadrneovim-20f52f4235760cb4c10a85e5016453598fc0e170.tar.gz
rneovim-20f52f4235760cb4c10a85e5016453598fc0e170.tar.bz2
rneovim-20f52f4235760cb4c10a85e5016453598fc0e170.zip
tui: Only send the pastetoggle key if necessary
-rw-r--r--src/nvim/tui/term_input.inl6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/tui/term_input.inl b/src/nvim/tui/term_input.inl
index dba970e8f2..2e94742fa7 100644
--- a/src/nvim/tui/term_input.inl
+++ b/src/nvim/tui/term_input.inl
@@ -10,6 +10,7 @@
struct term_input {
int in_fd;
+ bool paste_enabled;
TermKey *tk;
uv_tty_t input_handle;
uv_timer_t timer_handle;
@@ -175,6 +176,9 @@ static bool handle_bracketed_paste(TermInput *input)
bool enable = ptr[4] == '0';
// Advance past the sequence
rbuffer_consumed(input->read_buffer, 6);
+ if (input->paste_enabled == enable) {
+ return true;
+ }
if (enable) {
// Get the current mode
int state = get_real_state();
@@ -190,6 +194,7 @@ static bool handle_bracketed_paste(TermInput *input)
}
}
input_enqueue(cstr_as_string(PASTETOGGLE_KEY));
+ input->paste_enabled = enable;
return true;
}
return false;
@@ -240,6 +245,7 @@ static void read_cb(RStream *rstream, void *rstream_data, bool eof)
static TermInput *term_input_new(void)
{
TermInput *rv = xmalloc(sizeof(TermInput));
+ rv->paste_enabled = false;
// read input from stderr if stdin is not a tty
rv->in_fd = os_isatty(0) ? 0 : (os_isatty(2) ? 2 : 0);