From 6d78424cacf8d1abb06402e5c4942ff771167476 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 8 Oct 2023 11:55:05 +1100 Subject: [PATCH 1/2] 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 47b5f567146..c6f5a15d5c4 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" }) From 693e31132f4d9cf7f7dc9afab6922da6f90c4be7 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 8 Oct 2023 11:57:10 +1100 Subject: [PATCH 2/2] feat: notify [NvimTree] prefix is multiline only if the message is multiline --- lua/nvim-tree/notify.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-tree/notify.lua b/lua/nvim-tree/notify.lua index c6f5a15d5c4..1a81b3c103b 100644 --- a/lua/nvim-tree/notify.lua +++ b/lua/nvim-tree/notify.lua @@ -34,7 +34,7 @@ do vim.schedule(function() if not M.supports_title() then -- 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) + msg = string.format("[NvimTree]%s%s", (msg:match "\n" and "\n" or " "), msg) end vim.notify(msg, level, { title = "NvimTree" })