aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/tui/input.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-09-25 10:30:20 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-10-01 15:22:48 -0300
commit1143b416ab7d8bb1707dab2be2cd9e191f9a03e4 (patch)
treea244c0f5a5b8845b4b8d1dc55ef58420ae720658 /src/nvim/tui/input.c
parentc1edd0799000956b8bd23cbc49a4b015e117879e (diff)
downloadrneovim-1143b416ab7d8bb1707dab2be2cd9e191f9a03e4.tar.gz
rneovim-1143b416ab7d8bb1707dab2be2cd9e191f9a03e4.tar.bz2
rneovim-1143b416ab7d8bb1707dab2be2cd9e191f9a03e4.zip
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
Diffstat (limited to 'src/nvim/tui/input.c')
-rw-r--r--src/nvim/tui/input.c21
1 files changed, 1 insertions, 20 deletions
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 "<f37>"
+#define PASTETOGGLE_KEY "<Paste>"
#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;