Skip to content

Commit da10302

Browse files
committed
fix(buffer): clear namespace on render
Extmarks could build up when replacing notifications which could hugely decrease performance over time. See #71
1 parent 2c93e29 commit da10302

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lua/notify/service/buffer/init.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ function NotificationBuf:render()
9494
local notif = self._notif
9595
local buf = self._buffer
9696

97+
local render_namespace = require("notify.render.base").namespace()
9798
api.nvim_buf_set_option(buf, "filetype", "notify")
9899
api.nvim_buf_set_option(buf, "modifiable", true)
100+
api.nvim_buf_clear_namespace(buf, render_namespace, 0, -1)
99101

100102
notif.render(buf, notif, self.highlights)
101103

@@ -106,7 +108,6 @@ function NotificationBuf:render()
106108
for _, line in pairs(lines) do
107109
width = math.max(width, vim.str_utfindex(line))
108110
end
109-
local render_namespace = require("notify.render.base").namespace()
110111
local success, extmarks = pcall(
111112
api.nvim_buf_get_extmarks,
112113
buf,

0 commit comments

Comments
 (0)