mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
tui: Only send the pastetoggle key if necessary
This commit is contained in:
parent
8efb3607a7
commit
20f52f4235
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
struct term_input {
|
struct term_input {
|
||||||
int in_fd;
|
int in_fd;
|
||||||
|
bool paste_enabled;
|
||||||
TermKey *tk;
|
TermKey *tk;
|
||||||
uv_tty_t input_handle;
|
uv_tty_t input_handle;
|
||||||
uv_timer_t timer_handle;
|
uv_timer_t timer_handle;
|
||||||
@ -175,6 +176,9 @@ static bool handle_bracketed_paste(TermInput *input)
|
|||||||
bool enable = ptr[4] == '0';
|
bool enable = ptr[4] == '0';
|
||||||
// Advance past the sequence
|
// Advance past the sequence
|
||||||
rbuffer_consumed(input->read_buffer, 6);
|
rbuffer_consumed(input->read_buffer, 6);
|
||||||
|
if (input->paste_enabled == enable) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (enable) {
|
if (enable) {
|
||||||
// Get the current mode
|
// Get the current mode
|
||||||
int state = get_real_state();
|
int state = get_real_state();
|
||||||
@ -190,6 +194,7 @@ static bool handle_bracketed_paste(TermInput *input)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
input_enqueue(cstr_as_string(PASTETOGGLE_KEY));
|
input_enqueue(cstr_as_string(PASTETOGGLE_KEY));
|
||||||
|
input->paste_enabled = enable;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -240,6 +245,7 @@ static void read_cb(RStream *rstream, void *rstream_data, bool eof)
|
|||||||
static TermInput *term_input_new(void)
|
static TermInput *term_input_new(void)
|
||||||
{
|
{
|
||||||
TermInput *rv = xmalloc(sizeof(TermInput));
|
TermInput *rv = xmalloc(sizeof(TermInput));
|
||||||
|
rv->paste_enabled = false;
|
||||||
// read input from stderr if stdin is not a tty
|
// read input from stderr if stdin is not a tty
|
||||||
rv->in_fd = os_isatty(0) ? 0 : (os_isatty(2) ? 2 : 0);
|
rv->in_fd = os_isatty(0) ? 0 : (os_isatty(2) ? 2 : 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user