summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 11:39:16 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 11:39:16 +0200
commitcd832008fd96082ac36e32dbde26aefb7147b4c9 (patch)
tree806cefad5c516e837ee7aa64d09ce2f6a42ffaf7 /tests
parentce063ff1737aba8a2da2c2644e03517dd1a318c8 (diff)
Implement cursor presentation lease
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua36
1 files changed, 36 insertions, 0 deletions
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