feat: notify [NvimTree] prefix is multiline only if the message is multiline (#2453)

* feat: notify [NvimTree] prefix is multiline only if the message is multiline

* feat: notify [NvimTree] prefix is multiline only if the message is multiline
This commit is contained in:
Alexander Courtis 2023-10-14 18:03:13 +11:00 committed by GitHub
parent 53b0bcaada
commit e64a498a5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,13 +27,14 @@ local modes = {
do do
local dispatch = function(level, msg) local dispatch = function(level, msg)
if level < config.threshold then if level < config.threshold or not msg then
return return
end end
vim.schedule(function() vim.schedule(function()
if not M.supports_title() then if not M.supports_title() then
msg = "[NvimTree]\n" .. msg -- add title to the message, with a newline if the message is multiline
msg = string.format("[NvimTree]%s%s", (msg:match "\n" and "\n" or " "), msg)
end end
vim.notify(msg, level, { title = "NvimTree" }) vim.notify(msg, level, { title = "NvimTree" })