mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #16602 from zeertzjq/tui-end-streamed-paste
This commit is contained in:
commit
f37c5f180a
@ -114,6 +114,12 @@ static void tinput_done_event(void **argv)
|
|||||||
static void tinput_wait_enqueue(void **argv)
|
static void tinput_wait_enqueue(void **argv)
|
||||||
{
|
{
|
||||||
TermInput *input = argv[0];
|
TermInput *input = argv[0];
|
||||||
|
if (rbuffer_size(input->key_buffer) == 0 && input->paste == 3) {
|
||||||
|
const String keys = { .data = "", .size = 0 };
|
||||||
|
String copy = copy_string(keys);
|
||||||
|
multiqueue_put(main_loop.events, tinput_paste_event, 3,
|
||||||
|
copy.data, copy.size, (intptr_t)input->paste);
|
||||||
|
}
|
||||||
RBUFFER_UNTIL_EMPTY(input->key_buffer, buf, len) {
|
RBUFFER_UNTIL_EMPTY(input->key_buffer, buf, len) {
|
||||||
const String keys = { .data = buf, .size = len };
|
const String keys = { .data = buf, .size = len };
|
||||||
if (input->paste) {
|
if (input->paste) {
|
||||||
|
@ -765,6 +765,44 @@ describe('TUI', function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('paste: streamed paste with isolated "stop paste" code', function()
|
||||||
|
child_session:request('nvim_exec_lua', [[
|
||||||
|
_G.paste_phases = {}
|
||||||
|
vim.paste = (function(overridden)
|
||||||
|
return function(lines, phase)
|
||||||
|
table.insert(_G.paste_phases, phase)
|
||||||
|
overridden(lines, phase)
|
||||||
|
end
|
||||||
|
end)(vim.paste)
|
||||||
|
]], {})
|
||||||
|
feed_data('i')
|
||||||
|
feed_data('\027[200~pasted') -- phase 1
|
||||||
|
screen:expect([[
|
||||||
|
pasted{1: } |
|
||||||
|
{4:~ }|
|
||||||
|
{4:~ }|
|
||||||
|
{4:~ }|
|
||||||
|
{5:[No Name] [+] }|
|
||||||
|
{3:-- INSERT --} |
|
||||||
|
{3:-- TERMINAL --} |
|
||||||
|
]])
|
||||||
|
feed_data(' from terminal') -- phase 2
|
||||||
|
screen:expect([[
|
||||||
|
pasted from terminal{1: } |
|
||||||
|
{4:~ }|
|
||||||
|
{4:~ }|
|
||||||
|
{4:~ }|
|
||||||
|
{5:[No Name] [+] }|
|
||||||
|
{3:-- INSERT --} |
|
||||||
|
{3:-- TERMINAL --} |
|
||||||
|
]])
|
||||||
|
-- Send isolated "stop paste" sequence.
|
||||||
|
feed_data('\027[201~') -- phase 3
|
||||||
|
screen:expect_unchanged()
|
||||||
|
local _, rv = child_session:request('nvim_exec_lua', [[return _G.paste_phases]], {})
|
||||||
|
eq({1, 2, 3}, rv)
|
||||||
|
end)
|
||||||
|
|
||||||
it('allows termguicolors to be set at runtime', function()
|
it('allows termguicolors to be set at runtime', function()
|
||||||
screen:set_option('rgb', true)
|
screen:set_option('rgb', true)
|
||||||
screen:set_default_attr_ids({
|
screen:set_default_attr_ids({
|
||||||
|
Loading…
Reference in New Issue
Block a user