Skip to content

Commit e64a498

Browse files
authored
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
1 parent 53b0bca commit e64a498

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lua/nvim-tree/notify.lua

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ local modes = {
2727

2828
do
2929
local dispatch = function(level, msg)
30-
if level < config.threshold then
30+
if level < config.threshold or not msg then
3131
return
3232
end
3333

3434
vim.schedule(function()
3535
if not M.supports_title() then
36-
msg = "[NvimTree]\n" .. msg
36+
-- add title to the message, with a newline if the message is multiline
37+
msg = string.format("[NvimTree]%s%s", (msg:match "\n" and "\n" or " "), msg)
3738
end
3839

3940
vim.notify(msg, level, { title = "NvimTree" })

0 commit comments

Comments
 (0)