From e64a498a5eb9169ff9673ef6a409005040d29c4c Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 14 Oct 2023 18:03:13 +1100 Subject: [PATCH] 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 --- lua/nvim-tree/notify.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree/notify.lua b/lua/nvim-tree/notify.lua index 47b5f567..1a81b3c1 100644 --- a/lua/nvim-tree/notify.lua +++ b/lua/nvim-tree/notify.lua @@ -27,13 +27,14 @@ local modes = { do local dispatch = function(level, msg) - if level < config.threshold then + if level < config.threshold or not msg then return end vim.schedule(function() 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 vim.notify(msg, level, { title = "NvimTree" })