diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 14:27:24 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 14:27:24 +0200 |
| commit | 890cedb3003d45ded2327e483675c42fdfe024f1 (patch) | |
| tree | 0e7334ba15c6419bf7b7b4fda1ce145c6ee778c6 /tests | |
| parent | ae03a565105416f52a09bc0a171a7fdbb9ced5a0 (diff) | |
Preserve cursor presentation state
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.lua | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index e0c9b0c..5ca4f34 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -361,6 +361,60 @@ test("ActionOutcome and DotPayload retain resolved result data", function() same("problem", domain.ActionOutcome.error(destination, "problem").diagnostic) end) +test("Host adapter restores exact cursor presentation values", function() + local options = { + guicursor = "n:block,i:ver37-blinkon123", + t_ve = "terminal-visible-sequence", + } + local writes = {} + local runtime = { + api = { + nvim_get_option_value = function(name, request) + same("global", request.scope) + return options[name] + end, + nvim_set_option_value = function(name, value, request) + same("global", request.scope) + options[name] = value + writes[#writes + 1] = { name = name, value = value } + end, + nvim_cmd = function(command) + same("let", command.cmd) + same("&t_ve", command.args[1]) + same("=", command.args[2]) + options.t_ve = command.args[3] + writes[#writes + 1] = { name = "t_ve", value = command.args[3] } + end, + }, + fn = { + exists = function(name) + same("+t_ve", name) + return 1 + end, + eval = function(name) + same("&t_ve", name) + return options.t_ve + end, + string = function(value) + return value + end, + }, + } + local adapter = host_adapter.new({ runtime = runtime }) + truthy(adapter:supports_cursor_presentation()) + + local lease = adapter:suppress_cursor_presentation() + truthy(lease ~= nil) + same("a:ver1", options.guicursor) + same("", options.t_ve) + + truthy(adapter:restore_cursor_presentation(lease)) + same("n:block,i:ver37-blinkon123", options.guicursor) + same("terminal-visible-sequence", options.t_ve) + falsy(adapter:restore_cursor_presentation(lease)) + same(4, #writes) +end) + test("Host adapter owns Nvim timers and event registrations", function() local timer_callbacks = {} local stopped_timers = {} |
