fix(dashboard): check uis for headless and stdin_tty. Fixes #97. Fixes #98

This commit is contained in:
Folke Lemaitre 2024-11-18 20:35:53 +01:00
parent 735f4d8c9d
commit 4ff08f1c4d
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -986,9 +986,22 @@ function M.setup()
return
end
if vim.bo[buf].modified then
M.status.reason = "buffer is modified"
return
end
local uis = vim.api.nvim_list_uis()
-- check for headless
if #uis == 0 then
M.status.reason = "headless"
return
end
-- don't open the dashboard if input is piped
if uv.guess_handle(3) == "pipe" then
M.status.reason = "stdin is a pipe"
if uis[1].stdin_tty == false then
M.status.reason = "stdin is not a tty"
return
end