mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 10:56:31 +00:00
TUI/paste: always flush on paste mode-change
Flush input before entering, not only when leaving, paste mode. Else there could be pending input which will erroneously be sent to the paste handler.
This commit is contained in:
@@ -96,17 +96,19 @@ end
|
||||
-- Default paste function.
|
||||
local function _paste(data)
|
||||
-- local eof = (data == {''})
|
||||
local curline = vim.api.nvim_call_function('line', {'.'})
|
||||
local curline = vim.api.nvim_call_function('line', {'.'}) - 1
|
||||
vim.api.nvim_buf_set_lines(
|
||||
0,
|
||||
curline,
|
||||
curline,
|
||||
false,
|
||||
data)
|
||||
vim.api.nvim_call_function('cursor', {curline + #data, 1})
|
||||
vim.api.nvim_call_function(
|
||||
'cursor',
|
||||
{curline + #data, 9999999})
|
||||
-- TODO: do not redraw (slow!) until paste is finished.
|
||||
-- if eof then
|
||||
-- vim.api.nvim_command('redraw')
|
||||
-- end
|
||||
vim.api.nvim_command('redraw')
|
||||
return 0
|
||||
end
|
||||
|
||||
|
@@ -16,8 +16,6 @@
|
||||
#include "nvim/os/input.h"
|
||||
#include "nvim/event/rstream.h"
|
||||
|
||||
#define PASTE_KEY "<Paste>"
|
||||
#define PASTEPOST_KEY "<PastePost>"
|
||||
#define KEY_BUFFER_SIZE 0xfff
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
@@ -401,9 +399,7 @@ static bool handle_bracketed_paste(TermInput *input)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!enable) {
|
||||
tinput_flush(input, true);
|
||||
}
|
||||
tinput_flush(input, true);
|
||||
input->paste_enabled = enable;
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user