Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution for issues 105 #111

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions lua/true-zen/ataraxis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -234,23 +234,24 @@ end

function M.off()
data.do_callback("ataraxis", "close", "pre")

local cursor_pos
if api.nvim_win_is_valid(win.main) then
if pcall(function() api.nvim_win_is_valid(win.main) end) and api.nvim_win_is_valid(win.main) then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only change may need is

if win.main and api.nvim_win_is_valid(win.main) then

But I may be wrong.

if win.main ~= api.nvim_get_current_win() then
fn.win_gotoid(win.main)
end
cursor_pos = fn.getpos(".")
else
data.do_callback("ataraxis", "close", "pos")
return 1 -- already off
end

cmd("only")

if fn.filereadable(fn.expand("%:p")) == 1 then
cmd("q")
pcall(function () pcall(cmd("q")) end)
end

require("true-zen.minimalist").off()

for k, v in pairs(original_opts) do
for k, v in pairs(original_opts) do
if k ~= "highlights" then
o[k] = v
end
Expand Down