From 850084b519e18122820478a71bb4bfa4c15e528a Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Mon, 13 Jan 2025 19:39:03 -0800 Subject: refactor: use nvim.foo.bar format for namespaces --- test/functional/lua/hl_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/lua/hl_spec.lua') diff --git a/test/functional/lua/hl_spec.lua b/test/functional/lua/hl_spec.lua index 89881973bf..3f903d43a9 100644 --- a/test/functional/lua/hl_spec.lua +++ b/test/functional/lua/hl_spec.lua @@ -144,7 +144,7 @@ describe('vim.hl.on_yank', function() vim.api.nvim_buf_set_mark(0, ']', 1, 1, {}) vim.hl.on_yank({ timeout = math.huge, on_macro = true, event = { operator = 'y' } }) end) - local ns = api.nvim_create_namespace('hlyank') + local ns = api.nvim_create_namespace('nvim.hlyank') local win = api.nvim_get_current_win() eq({ win }, api.nvim__ns_get(ns).wins) command('wincmd w') @@ -158,7 +158,7 @@ describe('vim.hl.on_yank', function() vim.api.nvim_buf_set_mark(0, ']', 1, 1, {}) vim.hl.on_yank({ timeout = math.huge, on_macro = true, event = { operator = 'y' } }) end) - local ns = api.nvim_create_namespace('hlyank') + local ns = api.nvim_create_namespace('nvim.hlyank') eq(api.nvim_get_current_win(), api.nvim__ns_get(ns).wins[1]) command('wincmd w') exec_lua(function() -- cgit From af0ef2ac9dd19b7c4005a3197334d3e7d554646c Mon Sep 17 00:00:00 2001 From: Siddhant Agarwal <68201519+siddhantdev@users.noreply.github.com> Date: Wed, 22 Jan 2025 21:16:24 +0530 Subject: 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()`. --- test/functional/lua/hl_spec.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/functional/lua/hl_spec.lua') 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() -- cgit From fd55c7df6f7eb61c65e93c6dd8beffaeed93d2ed Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 23 Jan 2025 08:11:53 +0800 Subject: test(lua/hl_spec): set timeout for transient state (#32169) --- test/functional/lua/hl_spec.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'test/functional/lua/hl_spec.lua') diff --git a/test/functional/lua/hl_spec.lua b/test/functional/lua/hl_spec.lua index aed37cc294..512f6be48f 100644 --- a/test/functional/lua/hl_spec.lua +++ b/test/functional/lua/hl_spec.lua @@ -106,19 +106,22 @@ describe('vim.hl.range', function() end) it('removes highlight after given `timeout`', function() - local timeout = 50 + local timeout = 100 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([[ + screen:expect({ + grid = [[ {10:^asdfghjkl}{100:$} | {10:«口=口»}{100:$} | {10:qwertyuiop}{100:$} | {10:口口=口口}{1:$} | zxcvbnm{1:$} | | - ]]) + ]], + timeout = timeout, + }) screen:expect([[ ^asdfghjkl{1:$} | «口=口»{1:$} | -- cgit