aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-08-29 12:16:31 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2019-08-31 09:20:24 +0200
commit7a857928842476bce8c9bed7cf549fc76c4e6489 (patch)
tree1ee399db9dd38bf498566a91bacf852dc8c2aae5 /test
parent8a03acb8dad4abaf507d502b11a66bd5a2b5e51e (diff)
downloadrneovim-7a857928842476bce8c9bed7cf549fc76c4e6489.tar.gz
rneovim-7a857928842476bce8c9bed7cf549fc76c4e6489.tar.bz2
rneovim-7a857928842476bce8c9bed7cf549fc76c4e6489.zip
tui/input: defer nvim_paste properly.
Otherwise cursor and redraw code for normal and insert mode will not run. The "tickle" workaround was used for this instead, and can now be removed. The builtin vim.lua got the name [string "-- Nvim-Lua stdlib: thevimmodule (:help l..."] in error messages. Fix it to something reasonable.
Diffstat (limited to 'test')
-rw-r--r--test/functional/terminal/tui_spec.lua26
1 files changed, 21 insertions, 5 deletions
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 8d8c0e3647..07c91d43e1 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -352,15 +352,23 @@ describe('TUI', function()
]]}
-- Start pasting...
feed_data('\027[200~line 1\nline 2\n')
- expect_child_buf_lines({'foo',''})
- screen:expect{any='paste: Error executing lua'}
+ screen:expect{grid=[[
+ foo |
+ |
+ {5: }|
+ {8:paste: Error executing lua: [string "<nvim>"]:2: f}|
+ {8:ake fail} |
+ {10:Press ENTER or type command to continue}{1: } |
+ {3:-- TERMINAL --} |
+ ]]}
-- Remaining chunks are discarded after vim.paste() failure.
feed_data('line 3\nline 4\n')
feed_data('line 5\nline 6\n')
feed_data('line 7\nline 8\n')
-- Stop paste.
feed_data('\027[201~')
- feed_data('\n') -- <Enter>
+ feed_data('\n') -- <CR>
+ expect_child_buf_lines({'foo',''})
--Dot-repeat/redo is not modified by failed paste.
feed_data('.')
screen:expect{grid=[[
@@ -388,7 +396,7 @@ describe('TUI', function()
vim.paste = _G.save_paste_fn
]], {})
feed_data('\027[200~line A\nline B\n\027[201~')
- feed_data('\n') -- <Enter>
+ feed_data('\n') -- <CR>
screen:expect{grid=[[
foo |
typed input...line A |
@@ -414,7 +422,15 @@ describe('TUI', function()
it("paste: 'nomodifiable' buffer", function()
child_session:request('nvim_command', 'set nomodifiable')
feed_data('\027[200~fail 1\nfail 2\n\027[201~')
- screen:expect{any='Vim:E21'}
+ screen:expect{grid=[[
+ |
+ {4:~ }|
+ {5: }|
+ {8:paste: Error executing lua: vim.lua:194: Vim:E21: }|
+ {8:Cannot make changes, 'modifiable' is off} |
+ {10:Press ENTER or type command to continue}{1: } |
+ {3:-- TERMINAL --} |
+ ]]}
feed_data('\n') -- <Enter>
child_session:request('nvim_command', 'set modifiable')
feed_data('\027[200~success 1\nsuccess 2\n\027[201~')