Skip to content

Commit de3fe1f

Browse files
juniorsundar-tiijuniorsundar
authored andcommitted
refactor(agenda-views): Views buffer close properly
chore: autoformat with stylua
1 parent 6800ad8 commit de3fe1f

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lua/neorg/modules/external/many-mans/module.lua

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -762,8 +762,8 @@ module.public = {
762762
for _, opt in ipairs(module.public["buff-man"].default_winopts) do
763763
vim.api.nvim_set_option_value(opt[1], opt[2], { win = module.public["buff-man"].win })
764764
end
765-
vim.api.nvim_buf_delete(module.public["buff-man"].buf, { force = true })
766-
module.public["buff-man"].win = nil
765+
766+
vim.cmd("bdelete!")
767767

768768
if parsed_link.link_type == "line_number" then
769769
vim.cmd("edit +" .. parsed_link.link_location_text .. " " .. parsed_link.link_file_text)
@@ -779,14 +779,14 @@ module.public = {
779779
create_view_buffer = function(buffer_lines)
780780
-- Populate the default_winopts table with current window options
781781
module.public["buff-man"].win = vim.api.nvim_get_current_win()
782-
module.public["buff-man"].buf = vim.api.nvim_create_buf(true, true)
782+
module.public["buff-man"].buf = vim.api.nvim_get_current_buf()
783783
for _, opt in ipairs(module.public["buff-man"].default_winopts) do
784784
opt[2] = vim.api.nvim_get_option_value(opt[1], { win = module.public["buff-man"].win })
785785
end
786786

787-
module.public["buff-man"].buf = vim.api.nvim_create_buf(true, true)
787+
vim.cmd("tabnew")
788+
module.public["buff-man"].buf = vim.api.nvim_get_current_buf()
788789
module.public["buff-man"].win = vim.api.nvim_get_current_win()
789-
vim.api.nvim_win_set_buf(module.public["buff-man"].win, module.public["buff-man"].buf)
790790
vim.api.nvim_buf_set_lines(module.public["buff-man"].buf, 0, -1, false, buffer_lines)
791791

792792
-- Set buffer options for display and interaction
@@ -814,8 +814,7 @@ module.public = {
814814
for _, opt in ipairs(module.public["buff-man"].default_winopts) do
815815
vim.api.nvim_set_option_value(opt[1], opt[2], { win = module.public["buff-man"].win })
816816
end
817-
vim.api.nvim_buf_delete(module.public["buff-man"].buf, { force = true })
818-
module.public["buff-man"].win = nil
817+
vim.cmd("bdelete!")
819818
end,
820819
})
821820

0 commit comments

Comments
 (0)