diff options
author | Sean Dewar <6256228+seandewar@users.noreply.github.com> | 2025-02-19 10:47:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-19 10:47:44 +0000 |
commit | f3ce67549c946815e64845f27f6f46f1aaeb5ec6 (patch) | |
tree | 19f5b8ff054930568d31a057f3e3f3ecfdb0835a /test/functional/terminal/cursor_spec.lua | |
parent | a3eb49f6382ba6fd6a61ecfebd7b526fa9730e29 (diff) | |
download | rneovim-f3ce67549c946815e64845f27f6f46f1aaeb5ec6.tar.gz rneovim-f3ce67549c946815e64845f27f6f46f1aaeb5ec6.tar.bz2 rneovim-f3ce67549c946815e64845f27f6f46f1aaeb5ec6.zip |
fix(terminal): avoid more `busy_start` lacking `busy_stop` (#32509)
Problem: after #32458, it may still be possible for `busy_start` UI events to be
emitted without matching `busy_stop`s in the terminal.
Solution: do `terminal_enter`'s cursor visibility check immediately after
setting/restoring State so it occurs before events. This ensures that if pending
escape sequences are processed while in `terminal_enter`, the cursor's initial
visibility is set before `is_focused` is checked by `term_settermprop`.
As a result, we can move the call to `showmode` back to where it was originally.
Diffstat (limited to 'test/functional/terminal/cursor_spec.lua')
-rw-r--r-- | test/functional/terminal/cursor_spec.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua index a824893ce3..8ebad14f15 100644 --- a/test/functional/terminal/cursor_spec.lua +++ b/test/functional/terminal/cursor_spec.lua @@ -382,6 +382,31 @@ describe(':terminal cursor', function() ^ | |*5 ]]) + + feed('i') + screen:expect([[ + tty ready | + |*5 + {3:-- TERMINAL --} | + ]]) + + -- Cursor currently hidden; request to show it while in a TermLeave autocmd. + -- Process events (via :sleep) to handle the escape sequence immediately. + command([[autocmd TermLeave * ++once call chansend(b:terminal_job_id, "\e[?25h") | sleep 1m]]) + feed([[<C-\><C-N>]]) -- Exit terminal mode + screen:expect([[ + tty ready | + ^ | + |*5 + ]]) + + feed('i') + screen:expect([[ + tty ready | + ^ | + |*4 + {3:-- TERMINAL --} | + ]]) end) end) |