aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-08-19 00:41:58 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-08-27 21:19:10 +0200
commit4389401a7c82ca43a3634f65f57815af06fe9abd (patch)
tree16172d983dade5f7402222fd00fb539247029495
parent68ea9a7c8a7a74ec6ec9782528527cf70b92a376 (diff)
downloadrneovim-4389401a7c82ca43a3634f65f57815af06fe9abd.tar.gz
rneovim-4389401a7c82ca43a3634f65f57815af06fe9abd.tar.bz2
rneovim-4389401a7c82ca43a3634f65f57815af06fe9abd.zip
paste: abort paste if handler does not return true
-rw-r--r--src/nvim/lua/vim.lua2
-rw-r--r--src/nvim/tui/input.c5
2 files changed, 3 insertions, 4 deletions
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua
index 47feba0f85..54fce47fd0 100644
--- a/src/nvim/lua/vim.lua
+++ b/src/nvim/lua/vim.lua
@@ -109,7 +109,7 @@ local function _paste(data)
-- TODO: do not redraw (slow!) until paste is finished.
-- if eof then
vim.api.nvim_command('redraw')
- return 0
+ return true -- Paste will not continue if not returning `true`.
end
-- TODO(ZyX-I): Create compatibility layer.
diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c
index b16f93ae66..163bc41dae 100644
--- a/src/nvim/tui/input.c
+++ b/src/nvim/tui/input.c
@@ -133,9 +133,8 @@ static void tinput_wait_enqueue(void **argv)
Object fret
= nvim_execute_lua(STATIC_CSTR_AS_STRING("return vim._paste(...)"),
args, &err);
- if ((fret.type == kObjectTypeInteger && fret.data.integer)
- || (fret.type == kObjectTypeBoolean && fret.data.boolean)
- || (fret.type == kObjectTypeString && fret.data.string.size)) {
+ if (fret.type != kObjectTypeBoolean || !fret.data.boolean) {
+ // Abort paste if handler does not return true.
input->paste_enabled = false;
}
api_free_object(fret);