Skip to content

Commit

Permalink
fix secure note session management
Browse files Browse the repository at this point in the history
Fixes #52
  • Loading branch information
mrjones2014 committed Sep 6, 2022
1 parent ac863e4 commit b11a813
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/op/securenotes/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ local function setup_secure_note_buf(win_id, note)
local buf_name = vim.api.nvim_buf_get_name(buf):sub(#title * -1)
return buf_name == title
end, vim.api.nvim_list_bufs())[1]
if existing_buf then
if existing_buf and session.get_for_buf_id(existing_buf) then
vim.api.nvim_win_set_buf(0, existing_buf)
return
end
Expand Down Expand Up @@ -108,7 +108,7 @@ local function setup_secure_note_buf(win_id, note)
},
{
-- kill session on buffer delete
'BufDelete',
{ 'BufDelete', 'BufWipeout' },
buffer = buf,
callback = function()
session.close_session_for_buf_id(buf)
Expand Down

0 comments on commit b11a813

Please sign in to comment.