aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2019-06-23 18:28:04 -0400
committerJustin M. Keyes <justinkz@gmail.com>2019-06-24 00:28:04 +0200
commit9fd4a0b52697db053143f51822e68da95c6886aa (patch)
tree1fe05b2d328eb96ce9dedfc143fe60e7713d85fc /test
parent0bdeec8ef02bcd497f6df77b2a00420c948c9438 (diff)
downloadrneovim-9fd4a0b52697db053143f51822e68da95c6886aa.tar.gz
rneovim-9fd4a0b52697db053143f51822e68da95c6886aa.tar.bz2
rneovim-9fd4a0b52697db053143f51822e68da95c6886aa.zip
getchar: Handle incomplete <Paste> in typeahead buffer #10311
<Paste> is a 3-byte sequence and the beginning one or two bytes can appear at the very end of the typeahead buffer. When this happens, we were exiting from `vgetorpeek()` instead of reading more characters to see the complete sequence. I think this should fix #7994 -- at least partially. Before this change, when I paste exactly 64 characters into a freshly booted instance, I get what I pasted plus the literal text "<Paste>" at the end. Nvim also stays in nopaste mode. The attached test case fails in this manner without the code change. Fix #7994
Diffstat (limited to 'test')
-rw-r--r--test/functional/terminal/tui_spec.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index a8a49cd378..0522d59c9a 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -182,6 +182,21 @@ describe('TUI', function()
]])
end)
+ it('handles pasting a specific amount of text', function()
+ -- Need extra time for this test, specially in ASAN.
+ screen.timeout = 60000
+ feed_data('i\027[200~'..string.rep('z', 64)..'\027[201~')
+ screen:expect([[
+ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz|
+ zzzzzzzzzzzzzz{1: } |
+ {4:~ }|
+ {4:~ }|
+ {5:[No Name] [+] }|
+ {3:-- INSERT --} |
+ {3:-- TERMINAL --} |
+ ]])
+ end)
+
it('can handle arbitrarily long bursts of input', function()
-- Need extra time for this test, specially in ASAN.
screen.timeout = 60000