fix(notifier): no gap in border without title/icon (#85)

## Description
Don't put padding with no title and no icon, so that there is no gap in
the border.
<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Related Issue(s)
Fixes #84.
<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

<!-- Add screenshots of the changes if applicable. -->

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
This commit is contained in:
Iordanis Petkakis 2024-11-16 07:58:28 +02:00 committed by GitHub
parent f126609b57
commit bc80bdcc62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -144,10 +144,11 @@ end
N.styles = {
-- style using border title
compact = function(buf, notif, ctx)
ctx.opts.title = {
{ " " .. vim.trim(notif.icon .. " " .. (notif.title or "")) .. " ", ctx.hl.title },
}
ctx.opts.title_pos = "center"
local title = vim.trim(notif.icon .. " " .. (notif.title or ""))
if title ~= "" then
ctx.opts.title = { { " " .. title .. " ", ctx.hl.title } }
ctx.opts.title_pos = "center"
end
vim.api.nvim_buf_set_lines(buf, 0, -1, false, vim.split(notif.msg, "\n"))
end,
minimal = function(buf, notif, ctx)