From efe1732c6fd802ca8fdccc1f0a26be87427f1e70 Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Wed, 1 Jan 2025 18:43:16 -0600 Subject: fix(jobs): do not block UI when jobwait() doesn't block (#31803) --- test/functional/core/job_spec.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test/functional/core/job_spec.lua') diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index 952437d80e..e833b5127d 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -973,6 +973,39 @@ describe('jobs', function() feed('') fn.jobstop(api.nvim_get_var('id')) end) + + it('does not set UI busy with zero timeout #31712', function() + local screen = Screen.new(50, 6) + command([[let g:id = jobstart(['sleep', '0.3'])]]) + local busy = 0 + screen._handle_busy_start = (function(orig) + return function() + orig(screen) + busy = busy + 1 + end + end)(screen._handle_busy_start) + source([[ + func PrintAndPoll() + echon "aaa\nbbb" + call jobwait([g:id], 0) + echon "\nccc" + endfunc + ]]) + feed_command('call PrintAndPoll()') + screen:expect { + grid = [[ + | + {3: }| + aaa | + bbb | + ccc | + {6:Press ENTER or type command to continue}^ | + ]], + } + feed('') + fn.jobstop(api.nvim_get_var('id')) + eq(0, busy) + end) end) pending('exit event follows stdout, stderr', function() -- cgit