aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/cursor_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-12-07 21:42:44 +0800
committerGitHub <noreply@github.com>2024-12-07 21:42:44 +0800
commit4817547ec4630c2af2c94ade07bbf220992ad0d7 (patch)
tree71c50001a8ffac5a75c0f3206fcae3d969f33aa1 /test/functional/ui/cursor_spec.lua
parent92e61072ac7493d85c15e3403f17619446782b51 (diff)
downloadrneovim-4817547ec4630c2af2c94ade07bbf220992ad0d7.tar.gz
rneovim-4817547ec4630c2af2c94ade07bbf220992ad0d7.tar.bz2
rneovim-4817547ec4630c2af2c94ade07bbf220992ad0d7.zip
feat(ex_cmds): :sleep! hides the cursor while sleeping (#31493)
Problem: :sleep! not hiding the cursor is an arbitrary difference from Vim without obvious justification, and Vim's behavior isn't easily achievable in Nvim. Solution: Make :sleep! hide the cursor while sleeping. Ref: https://github.com/neovim/neovim/commit/6a01b3fcc361960e559db459e1524418bc76dd66 https://github.com/neovim/neovim/commit/b5c0ade43790cf18f6a54858ddad30d8d9667cf9
Diffstat (limited to 'test/functional/ui/cursor_spec.lua')
-rw-r--r--test/functional/ui/cursor_spec.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/functional/ui/cursor_spec.lua b/test/functional/ui/cursor_spec.lua
index d7c0657820..edf826a1d9 100644
--- a/test/functional/ui/cursor_spec.lua
+++ b/test/functional/ui/cursor_spec.lua
@@ -361,4 +361,38 @@ describe('ui/cursor', function()
end
end)
end)
+
+ it(':sleep does not hide cursor when sleeping', function()
+ n.feed(':sleep 100m | echo 42\n')
+ screen:expect({
+ grid = [[
+ ^ |
+ {1:~ }|*3
+ :sleep 100m | echo 42 |
+ ]],
+ timeout = 100,
+ })
+ screen:expect([[
+ ^ |
+ {1:~ }|*3
+ 42 |
+ ]])
+ end)
+
+ it(':sleep! hides cursor when sleeping', function()
+ n.feed(':sleep! 100m | echo 42\n')
+ screen:expect({
+ grid = [[
+ |
+ {1:~ }|*3
+ :sleep! 100m | echo 42 |
+ ]],
+ timeout = 100,
+ })
+ screen:expect([[
+ ^ |
+ {1:~ }|*3
+ 42 |
+ ]])
+ end)
end)