folke / zen-mode.nvim

🧘 Distraction-free coding for Neovim
Apache License 2.0
1.66k stars 46 forks source link

bug: On quitall (:qa) in zen floating window, the terminal stick with +n fontsize #152

Closed componhead closed 3 weeks ago

componhead commented 3 weeks ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.10.0 Build type: Release LuaJIT 2.1.1716656478

Operating system/version

Sonoma 14.6.1

Describe the bug

terminal type: wezterm (with modified cfg)

Steps To Reproduce

  1. enter zen mode with font +n
  2. quitall (:qa)

Expected Behavior

Terminal should have -n zenmode font size

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    { "folke/zen-mode.nvim", opts = {} },
    -- add any other plugins here
  },
})
b0ae989c commented 3 weeks ago

This is not a bug. Plugin states get reset via view.plugins_on_close. If you don't call require('zen-mode').close() or require('zen-mode.view').plugins_on_close(), plugin states won't get reset.

Workaround:

vim.api.nvim_create_augroup('ZenModeFix', { clear = true })
vim.api.nvim_create_autocmd({ 'VimLeavePre' }, {
  group = 'ZenModeFix',
  callback = function() require('zen-mode').close() end,
})