From 2a8d80a442fcede4e0ecbbe96c92ff2d79eddf20 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 23 Sep 2024 19:50:57 +0800 Subject: [PATCH] test(tui_spec): prevent another case of race between paste and input (#30481) Problem: When input immediately follows end of bracketed paste, the nvim_input may be processed before the nvim_paste. Solution: Ensure some waiting after the end of a bracketed paste. (cherry picked from commit 5acdc4499e2036c90172b2b085f207ee4d5cfee4) --- test/functional/terminal/tui_spec.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 66c038fbd6..153289b9a7 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -973,6 +973,7 @@ describe('TUI', function() {3:-- TERMINAL --} | ]]) feed_data('\027[201~') -- End paste. + screen:expect_unchanged() feed_data('\027[27u') -- ESC: go to Normal mode. wait_for_mode('n') screen:expect([[ @@ -1184,6 +1185,7 @@ describe('TUI', function() expect_cmdline('"stuff 1 more"') -- End the paste sequence. feed_data('\027[201~') + expect_cmdline('"stuff 1 more"') feed_data(' typed') expect_cmdline('"stuff 1 more typed"') end) @@ -1227,6 +1229,7 @@ describe('TUI', function() feed_data('line 7\nline 8\n') -- Stop paste. feed_data('\027[201~') + screen:expect_unchanged() feed_data('\n') -- to dismiss hit-enter prompt expect_child_buf_lines({ 'foo', '' }) -- Dot-repeat/redo is not modified by failed paste. @@ -1274,6 +1277,7 @@ describe('TUI', function() {} ) feed_data('\027[200~line A\nline B\n\027[201~') + expect_child_buf_lines({ '' }) feed_data('ifoo\n\027[27u') expect_child_buf_lines({ 'foo', '' }) end) @@ -1396,7 +1400,6 @@ describe('TUI', function() feed_data('\n') -- Send the "stop paste" sequence. feed_data('\027[201~') - screen:expect([[ | pasted from terminal (1) |