From 6daef528c1422b33b2f2f713822602f9d66a5d51 Mon Sep 17 00:00:00 2001 From: Cameron Ring Date: Sun, 19 Oct 2025 02:09:19 -0700 Subject: [PATCH] fix(notifier): include icon in padding in minimal style (#2239) ## Description This prevents the text from running underneath the icon when the text is a single line and the text plus padding is less than max_width. It does not handle the case where the text is longer than max_width (with or without wrap). ## Related Issue(s) Fixes #2238 ## Screenshots Before: Screenshot 2025-10-03 at 13 52 39 After: Screenshot 2025-10-03 at 13 53 33 --- lua/snacks/notifier.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/snacks/notifier.lua b/lua/snacks/notifier.lua index 1de1f4f0..fa4dd1db 100644 --- a/lua/snacks/notifier.lua +++ b/lua/snacks/notifier.lua @@ -581,7 +581,9 @@ function N:render(notif) local lines = vim.api.nvim_buf_get_lines(buf, 0, -1, false) - local pad = self.opts.padding and (win:add_padding() or 2) or 0 + -- for the minimal style, we also have to factor in the icon width + local icon_width = self.opts.style == "minimal" and vim.api.nvim_strwidth(notif.icon) or 0 + local pad = (self.opts.padding and (win:add_padding() or 2) or 0) + icon_width local width = win:border_text_width() for _, line in ipairs(lines) do width = math.max(width, vim.fn.strdisplaywidth(line) + pad)