diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-09-11 12:45:28 -0700 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-09-11 12:45:28 -0700 |
commit | c8223e1618c4510f9eff13df509c6da95f869cc6 (patch) | |
tree | 0e73e8ef5fe40d1215dfe4647742fff2e58f1fde | |
parent | 6aed19b2bbe5fbc6df682d159fbc53e7e72c87ac (diff) | |
parent | ffa029ad1cc2f3ddc3f670f1c407deabbc1bec62 (diff) | |
download | rneovim-c8223e1618c4510f9eff13df509c6da95f869cc6.tar.gz rneovim-c8223e1618c4510f9eff13df509c6da95f869cc6.tar.bz2 rneovim-c8223e1618c4510f9eff13df509c6da95f869cc6.zip |
Merge #10995 'paste: fix paste in terminal mode'
-rw-r--r-- | src/nvim/lua/vim.lua | 2 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 29 |
2 files changed, 29 insertions, 2 deletions
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua index f8e52d31c9..a03e97490d 100644 --- a/src/nvim/lua/vim.lua +++ b/src/nvim/lua/vim.lua @@ -193,7 +193,7 @@ paste = (function() vim.api.nvim_input(line1) vim.api.nvim_set_option('paste', false) elseif mode ~= 'c' then -- Else: discard remaining cmdline-mode chunks. - if phase < 2 and mode ~= 'i' and mode ~= 'R' then + if phase < 2 and mode ~= 'i' and mode ~= 'R' and mode ~= 't' then vim.api.nvim_put(lines, 'c', true, true) -- XXX: Normal-mode: workaround bad cursor-placement after first chunk. vim.api.nvim_command('normal! a') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 3d9623a158..789f5d4c2f 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -306,6 +306,33 @@ describe('TUI', function() expect_child_buf_lines({''}) end) + it('paste: terminal mode', function() + feed_data(':set statusline=^^^^^^^\n') + feed_data(':terminal '..nvim_dir..'/tty-test\n') + feed_data('i') + screen:expect{grid=[[ + tty ready | + {1: } | + | + | + {5:^^^^^^^ }| + {3:-- TERMINAL --} | + {3:-- TERMINAL --} | + ]]} + feed_data('\027[200~') + feed_data('hallo') + feed_data('\027[201~') + screen:expect{grid=[[ + tty ready | + hallo{1: } | + | + | + {5:^^^^^^^ }| + {3:-- TERMINAL --} | + {3:-- TERMINAL --} | + ]]} + end) + it('paste: normal-mode (+CRLF #10872)', function() feed_data(':set ruler') wait_for_mode('c') @@ -512,7 +539,7 @@ describe('TUI', function() | {4:~ }| {5: }| - {8:paste: Error executing lua: vim.lua:196: Vim:E21: }| + {8:paste: Error executing lua: vim.lua:197: Vim:E21: }| {8:Cannot make changes, 'modifiable' is off} | {10:Press ENTER or type command to continue}{1: } | {3:-- TERMINAL --} | |