feat: has('terminfo')

Problem:
No way to detect at runtime if the build includes unibilium (or whatever
terminfo layer we swap it with later).

Solution:
Support `has('terminfo')`.
This commit is contained in:
Justin M. Keyes
2025-11-22 14:58:10 -05:00
parent d589ce28b0
commit 9044d64af9
5 changed files with 18 additions and 2 deletions

View File

@@ -64,6 +64,17 @@ describe('has()', function()
end
end)
it('"terminfo"', function()
-- Looks like "HAVE_UNIBILIUM ", "HAVE_UNIBILIUM=1", "HAVE_UNIBILIUM off", ….
-- Capture group returns the "1"/"off"/….
local build_flag =
vim.trim((n.exec_capture('verbose version'):match('HAVE_UNIBILIUM([^-]+)') or ''):lower())
-- XXX: the match() above fails in CI so currently we assume CI always builds with unibilium.
local is_enabled = t.is_ci()
or not (build_flag == '' or build_flag == 'false' or build_flag == '0' or build_flag == 'off')
eq(is_enabled and 1 or 0, fn.has('terminfo'))
end)
it('"wsl"', function()
local is_wsl = vim.uv.os_uname()['release']:lower():match('microsoft') and true or false
if is_wsl then