From cd832008fd96082ac36e32dbde26aefb7147b4c9 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 11:39:16 +0200 Subject: Implement cursor presentation lease --- tests/run.lua | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests') diff --git a/tests/run.lua b/tests/run.lua index 1bd0c64..be2a8b3 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -4457,6 +4457,42 @@ test("Cursor marker overlays the exact cursor byte position", function() same(0, #state:temporary_overlay_identities()) end) +test("Cursor presentation lease restores every prior value", function() + local prior = { + guicursor = "n-v:block,i:ver25", + terminal_cursor_visible = false, + terminal_cursor_shape = "beam", + hidden = false, + ui = { + blinkon = 375, + blinkoff = 225, + }, + } + local host = MemoryHost.new({ cursor_presentation = prior }) + local feedback = feedback_service.new(host) + + local lease = feedback:create_cursor_presentation_lease() + truthy(feedback_service.CursorPresentationLease.is(lease)) + truthy(lease.active) + truthy(lease.identity ~= nil) + local suppressed = host:cursor_presentation() + truthy(suppressed.hidden) + same(prior.guicursor, suppressed.guicursor) + same(prior.terminal_cursor_visible, suppressed.terminal_cursor_visible) + same(prior.ui.blinkon, suppressed.ui.blinkon) + + truthy(lease:release()) + falsy(lease.active) + local restored = host:cursor_presentation() + same(prior.guicursor, restored.guicursor) + same(prior.terminal_cursor_visible, restored.terminal_cursor_visible) + same(prior.terminal_cursor_shape, restored.terminal_cursor_shape) + same(prior.hidden, restored.hidden) + same(prior.ui.blinkon, restored.ui.blinkon) + same(prior.ui.blinkoff, restored.ui.blinkoff) + falsy(lease:release()) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3