diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-08-31 12:44:42 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-09-02 02:27:13 +0200 |
commit | 976c6667e140fe4dfe2731451b25c4a1309ad165 (patch) | |
tree | cd472c2334bcffcc83861d1ebbc878ea9efccdb7 /src/nvim/lua/vim.lua | |
parent | 801fe799ff359cdae66ed14f5e0b7c2c4cec9536 (diff) | |
download | rneovim-976c6667e140fe4dfe2731451b25c4a1309ad165.tar.gz rneovim-976c6667e140fe4dfe2731451b25c4a1309ad165.tar.bz2 rneovim-976c6667e140fe4dfe2731451b25c4a1309ad165.zip |
paste: one undo-block per stream
- All "chunks" in a paste-stream should form a single undo-block. Side
effect of 7a8579288424 was to create an undo-block for each chunk.
- Also: remove old :redraw force logic, irrelevant after 7a8579288424.
Diffstat (limited to 'src/nvim/lua/vim.lua')
-rw-r--r-- | src/nvim/lua/vim.lua | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua index fd34b8545d..0f2d243524 100644 --- a/src/nvim/lua/vim.lua +++ b/src/nvim/lua/vim.lua @@ -175,13 +175,15 @@ end --@returns false if client should cancel the paste. local function paste(lines, phase) end -- luacheck: no unused paste = (function() - local tdots, tredraw, tick, got_line1 = 0, 0, 0, false + local tdots, tick, got_line1 = 0, 0, false return function(lines, phase) local call = vim.api.nvim_call_function local now = vim.loop.now() local mode = call('mode', {}):sub(1,1) if phase < 2 then -- Reset flags. - tdots, tredraw, tick, got_line1 = now, now, 0, false + tdots, tick, got_line1 = now, 0, false + elseif mode ~= 'c' then + vim.api.nvim_command('undojoin') end if mode == 'c' and not got_line1 then -- cmdline-mode: paste only 1 line. got_line1 = (#lines > 1) @@ -193,11 +195,6 @@ paste = (function() else vim.api.nvim_put(lines, 'c', true, true) end - if (now - tredraw >= 1000) or phase == -1 or phase > 2 then - tredraw = now - vim.api.nvim_command('redraw') - vim.api.nvim_command('redrawstatus') - end if phase ~= -1 and (now - tdots >= 100) then local dots = ('.'):rep(tick % 4) tdots = now |