mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
parent
5689008060
commit
7a23b67d35
@ -1251,7 +1251,7 @@ Boolean nvim_paste(String data, Boolean crlf, Integer phase, Error *err)
|
|||||||
draining = true;
|
draining = true;
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
if (!(State & CMDLINE) && !(State & INSERT) && (phase == -1 || phase == 1)) {
|
if (!(State & (CMDLINE | INSERT)) && (phase == -1 || phase == 1)) {
|
||||||
ResetRedobuff();
|
ResetRedobuff();
|
||||||
AppendCharToRedobuff('a'); // Dot-repeat.
|
AppendCharToRedobuff('a'); // Dot-repeat.
|
||||||
}
|
}
|
||||||
@ -1269,7 +1269,7 @@ Boolean nvim_paste(String data, Boolean crlf, Integer phase, Error *err)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(State & CMDLINE) && !(State & INSERT) && (phase == -1 || phase == 3)) {
|
if (!(State & (CMDLINE | INSERT)) && (phase == -1 || phase == 3)) {
|
||||||
AppendCharToRedobuff(ESC); // Dot-repeat.
|
AppendCharToRedobuff(ESC); // Dot-repeat.
|
||||||
}
|
}
|
||||||
theend:
|
theend:
|
||||||
|
@ -206,8 +206,11 @@ paste = (function()
|
|||||||
local line1 = lines[1]:gsub('<', '<lt>'):gsub('[\r\n\012\027]', ' ') -- Scrub.
|
local line1 = lines[1]:gsub('<', '<lt>'):gsub('[\r\n\012\027]', ' ') -- Scrub.
|
||||||
vim.api.nvim_input(line1)
|
vim.api.nvim_input(line1)
|
||||||
vim.api.nvim_set_option('paste', false)
|
vim.api.nvim_set_option('paste', false)
|
||||||
elseif mode ~= 'c' then -- Else: discard remaining cmdline-mode chunks.
|
elseif mode ~= 'c' then
|
||||||
if phase < 2 and mode ~= 'i' and mode ~= 'R' and mode ~= 't' then
|
if phase < 2 and mode:find('^[vV\22sS\19]') then
|
||||||
|
vim.api.nvim_command([[exe "normal! \<Del>"]])
|
||||||
|
vim.api.nvim_put(lines, 'c', false, true)
|
||||||
|
elseif phase < 2 and not mode:find('^[iRt]') then
|
||||||
vim.api.nvim_put(lines, 'c', true, true)
|
vim.api.nvim_put(lines, 'c', true, true)
|
||||||
-- XXX: Normal-mode: workaround bad cursor-placement after first chunk.
|
-- XXX: Normal-mode: workaround bad cursor-placement after first chunk.
|
||||||
vim.api.nvim_command('normal! a')
|
vim.api.nvim_command('normal! a')
|
||||||
|
@ -302,6 +302,49 @@ describe('TUI', function()
|
|||||||
expect_child_buf_lines({''})
|
expect_child_buf_lines({''})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('paste: select-mode', function()
|
||||||
|
feed_data('ithis is line 1\nthis is line 2\nline 3 is here\n\027')
|
||||||
|
wait_for_mode('n')
|
||||||
|
screen:expect{grid=[[
|
||||||
|
this is line 1 |
|
||||||
|
this is line 2 |
|
||||||
|
line 3 is here |
|
||||||
|
{1: } |
|
||||||
|
{5:[No Name] [+] }|
|
||||||
|
|
|
||||||
|
{3:-- TERMINAL --} |
|
||||||
|
]]}
|
||||||
|
-- Select-mode. Use <C-n> to move down.
|
||||||
|
feed_data('gg04lgh\14\14')
|
||||||
|
wait_for_mode('s')
|
||||||
|
feed_data('\027[200~')
|
||||||
|
feed_data('just paste it™')
|
||||||
|
feed_data('\027[201~')
|
||||||
|
screen:expect{grid=[[
|
||||||
|
thisjust paste it™{1:3} is here |
|
||||||
|
|
|
||||||
|
{4:~ }|
|
||||||
|
{4:~ }|
|
||||||
|
{5:[No Name] [+] }|
|
||||||
|
|
|
||||||
|
{3:-- TERMINAL --} |
|
||||||
|
]]}
|
||||||
|
-- Undo.
|
||||||
|
feed_data('u')
|
||||||
|
expect_child_buf_lines{
|
||||||
|
'this is line 1',
|
||||||
|
'this is line 2',
|
||||||
|
'line 3 is here',
|
||||||
|
'',
|
||||||
|
}
|
||||||
|
-- Redo.
|
||||||
|
feed_data('\18') -- <C-r>
|
||||||
|
expect_child_buf_lines{
|
||||||
|
'thisjust paste it™3 is here',
|
||||||
|
'',
|
||||||
|
}
|
||||||
|
end)
|
||||||
|
|
||||||
it('paste: terminal mode', function()
|
it('paste: terminal mode', function()
|
||||||
feed_data(':set statusline=^^^^^^^\n')
|
feed_data(':set statusline=^^^^^^^\n')
|
||||||
feed_data(':terminal '..nvim_dir..'/tty-test\n')
|
feed_data(':terminal '..nvim_dir..'/tty-test\n')
|
||||||
@ -535,7 +578,7 @@ describe('TUI', function()
|
|||||||
|
|
|
|
||||||
{4:~ }|
|
{4:~ }|
|
||||||
{5: }|
|
{5: }|
|
||||||
{8:paste: Error executing lua: vim.lua:211: Vim:E21: }|
|
{8:paste: Error executing lua: vim.lua:214: Vim:E21: }|
|
||||||
{8:Cannot make changes, 'modifiable' is off} |
|
{8:Cannot make changes, 'modifiable' is off} |
|
||||||
{10:Press ENTER or type command to continue}{1: } |
|
{10:Press ENTER or type command to continue}{1: } |
|
||||||
{3:-- TERMINAL --} |
|
{3:-- TERMINAL --} |
|
||||||
|
Loading…
Reference in New Issue
Block a user