From 1143b416ab7d8bb1707dab2be2cd9e191f9a03e4 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Fri, 25 Sep 2015 10:30:20 -0300 Subject: tui: Don't use 'pastetoggle' for automatic pasting Add a new special key that can be used by UIs to toggle the 'paste' option and use it in the TUI instead of the user's 'pastetoggle' value. Close #2843 #2092 --- src/nvim/tui/input.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'src/nvim/tui') diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index 6c362540d0..55c834542f 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -9,7 +9,7 @@ #include "nvim/os/input.h" #include "nvim/event/rstream.h" -#define PASTETOGGLE_KEY "" +#define PASTETOGGLE_KEY "" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "tui/input.c.generated.h" @@ -34,11 +34,6 @@ void term_input_init(TermInput *input, Loop *loop) rstream_init_fd(loop, &input->read_stream, input->in_fd, 0xfff, input); // initialize a timer handle for handling ESC with libtermkey time_watcher_init(loop, &input->timer_handle, input); - // Set the pastetoggle option to a special key that will be sent when - // \e[20{0,1}~/ are received - Error err = ERROR_INIT; - vim_set_option(cstr_as_string("pastetoggle"), - STRING_OBJ(cstr_as_string(PASTETOGGLE_KEY)), &err); } void term_input_destroy(TermInput *input) @@ -230,20 +225,6 @@ static bool handle_bracketed_paste(TermInput *input) if (input->paste_enabled == enable) { return true; } - if (enable) { - // Get the current mode - int state = get_real_state(); - if (state & NORMAL) { - // Enter insert mode - enqueue_input("i", 1); - } else if (state & VISUAL) { - // Remove the selected text and enter insert mode - enqueue_input("c", 1); - } else if (!(state & INSERT)) { - // Don't mess with the paste option - return true; - } - } enqueue_input(PASTETOGGLE_KEY, sizeof(PASTETOGGLE_KEY) - 1); input->paste_enabled = enable; return true; -- cgit