aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/hl_spec.lua
diff options
context:
space:
mode:
authorSiddhant Agarwal <68201519+siddhantdev@users.noreply.github.com>2025-01-22 21:16:24 +0530
committerGitHub <noreply@github.com>2025-01-22 07:46:24 -0800
commitaf0ef2ac9dd19b7c4005a3197334d3e7d554646c (patch)
treec3bba66baa6eeddf592692220c6946b5f39825be /test/functional/lua/hl_spec.lua
parent34344b939c060d36db719f17088639744ca61c94 (diff)
downloadrneovim-af0ef2ac9dd19b7c4005a3197334d3e7d554646c.tar.gz
rneovim-af0ef2ac9dd19b7c4005a3197334d3e7d554646c.tar.bz2
rneovim-af0ef2ac9dd19b7c4005a3197334d3e7d554646c.zip
feat(lua): vim.hl.range() "timeout" #32012
Problem: `vim.hl.on_yank()` has a "timeout" behavior but this is not available for `vim.hl.range()`. Solution: Add `timeout` arg to `vim.hl.range()`.
Diffstat (limited to 'test/functional/lua/hl_spec.lua')
-rw-r--r--test/functional/lua/hl_spec.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/functional/lua/hl_spec.lua b/test/functional/lua/hl_spec.lua
index 3f903d43a9..aed37cc294 100644
--- a/test/functional/lua/hl_spec.lua
+++ b/test/functional/lua/hl_spec.lua
@@ -104,6 +104,30 @@ describe('vim.hl.range', function()
|
]])
end)
+
+ it('removes highlight after given `timeout`', function()
+ local timeout = 50
+ exec_lua(function()
+ local ns = vim.api.nvim_create_namespace('')
+ vim.hl.range(0, ns, 'Search', { 0, 0 }, { 4, 0 }, { timeout = timeout })
+ end)
+ screen:expect([[
+ {10:^asdfghjkl}{100:$} |
+ {10:«口=口»}{100:$} |
+ {10:qwertyuiop}{100:$} |
+ {10:口口=口口}{1:$} |
+ zxcvbnm{1:$} |
+ |
+ ]])
+ screen:expect([[
+ ^asdfghjkl{1:$} |
+ «口=口»{1:$} |
+ qwertyuiop{1:$} |
+ 口口=口口{1:$} |
+ zxcvbnm{1:$} |
+ |
+ ]])
+ end)
end)
describe('vim.hl.on_yank', function()