aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-08-20 01:21:27 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-08-27 21:19:10 +0200
commit5a2894d67753b408ada3b89c1b7fbd9152977203 (patch)
tree44b3c5f1ee0b88979143045a7f390d9f3549b3c7 /src
parente1177be363f84f5f4f34c21b760bc47f70d5fa48 (diff)
downloadrneovim-5a2894d67753b408ada3b89c1b7fbd9152977203.tar.gz
rneovim-5a2894d67753b408ada3b89c1b7fbd9152977203.tar.bz2
rneovim-5a2894d67753b408ada3b89c1b7fbd9152977203.zip
paste: use nvim_put()
Diffstat (limited to 'src')
-rw-r--r--src/nvim/lua/vim.lua22
-rw-r--r--src/nvim/tui/input.c1
2 files changed, 5 insertions, 18 deletions
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua
index 49eb99c81a..6759e4436b 100644
--- a/src/nvim/lua/vim.lua
+++ b/src/nvim/lua/vim.lua
@@ -94,26 +94,14 @@ local function _os_proc_children(ppid)
end
-- Default paste function.
-local function _paste(data)
+local function _paste(lines)
+ -- local eof = (lines == {''})
local call = vim.api.nvim_call_function
local mode = call('mode', {})
- if mode == 't' then
- call('chansend',
- {vim.api.nvim_buf_get_option(0, 'channel'), data})
- return true
- end
-
- -- local eof = (data == {''})
local curline = call('line', {'.'})
- vim.api.nvim_buf_set_lines(
- 0,
- curline,
- curline,
- false,
- data)
- call(
- 'cursor',
- {curline + #data, 9999999})
+ -- vim.api.nvim_set_option('paste', true)
+ vim.api.nvim_put(lines, 'c', false)
+ -- vim.api.nvim_set_option('paste', false)
-- TODO: do not redraw (slow!) until paste is finished.
-- if eof then
vim.api.nvim_command('redraw')
diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c
index 163bc41dae..79615e30da 100644
--- a/src/nvim/tui/input.c
+++ b/src/nvim/tui/input.c
@@ -100,7 +100,6 @@ static void tinput_done_event(void **argv)
input_done();
}
-// TODO: send [''] to indicate EOF.
static Array string_to_array(const String input)
{
Array ret = ARRAY_DICT_INIT;