Skip to content

Commit

Permalink
fix(render/compact): hide : when no title given (#196)
Browse files Browse the repository at this point in the history
Co-authored-by: Roee Shapira <roee.shapira@tensorleap.ai>
  • Loading branch information
5c077m4n and roee-shapira-tensorleap committed May 13, 2023
1 parent 159c6cf commit f3024b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -214,7 +214,7 @@ See `:help notify-render()` for details

![default](https://user-images.githubusercontent.com/24252670/141534868-fdcc9d03-9f7b-47fd-acfc-5a20b98e4e0a.png)

2. "minimal
2. "minimal"

![image](https://user-images.githubusercontent.com/24252670/141534952-bb0cf491-5bb4-473c-9a67-8adb5b23b232.png)

Expand Down
7 changes: 6 additions & 1 deletion lua/notify/render/compact.lua
Expand Up @@ -5,7 +5,12 @@ return function(bufnr, notif, highlights)
local icon = notif.icon
local title = notif.title[1]

local prefix = string.format("%s | %s:", icon, title)
local prefix
if type(title) == "string" and #title > 0 then
prefix = string.format("%s | %s:", icon, title)
else
prefix = string.format("%s |", icon)
end
notif.message[1] = string.format("%s %s", prefix, notif.message[1])

vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, notif.message)
Expand Down

0 comments on commit f3024b9

Please sign in to comment.