From d7af8707026968887ea4ee3a4e6fa51fd4372033 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 24 Sep 2026 13:30:07 +0100 Subject: fix(lua): enable nil-safety diagnostics in runtime code Enable EmmyLua's need-check-nil diagnostic and resolve nullable values through more precise types, explicit invariants, and guards for missing runtime state. Keep analyzer-specific workarounds local and update the affected API documentation. Exclude the bundled re.lua from analysis so its nil-check warnings do not fail CI. AI-assisted --- runtime/lua/vim/tty.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'runtime/lua/vim/tty.lua') diff --git a/runtime/lua/vim/tty.lua b/runtime/lua/vim/tty.lua index d9c2a119e9..97bf24e9c3 100644 --- a/runtime/lua/vim/tty.lua +++ b/runtime/lua/vim/tty.lua @@ -139,11 +139,11 @@ function M.query(caps, opts, on_response) local seq ---@type string? if rest:match('^=%x+$') then - seq = vim.text - .hexdecode(rest:sub(2)) - :gsub('\\E', '\027') - :gsub('%%p%d', '') - :gsub('\\(%d+)', string.char) + seq = vim.text.hexdecode(rest:sub(2)) + if not seq then + return -- Ignore malformed responses and leave the capability pending. + end + seq = seq:gsub('\\E', '\027'):gsub('%%p%d', ''):gsub('\\(%d+)', string.char) end on_response(cap, true, seq) -- cgit