noice.nvim icon indicating copy to clipboard operation
noice.nvim copied to clipboard

issue: window resized in session when open cmdpopup before leave nvim

Open vurtune opened this issue 6 months ago • 0 comments

Did you check docs and existing issues?

  • [X] I have read all the noice.nvim docs
  • [X] I have searched the existing issues of noice.nvim
  • [ ] I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.9.5

Operating system/version

Linux/Ubuntu (latest) - WSL

Describe the bug

I use persistence.nvim to save and restore session, windows sizes, tabs, buffers, etc. When I use ":qa", session don't save window size, but when I use key map (ctrl+q) to quit all, without open cmdpopup it save windows sizes. When I open cmdpopup and execute some command like ":ls" then I use key map (ctrl+q) to leave, it won't save window sizes. The problem becomes when I use cmdpopup. It only happens with Noice plugin, I can't figure out what lines of code are doing this behavior but I relate this to "mount:popup" class, maybe I'm wrong.

Steps To Reproduce

  1. Open nvim, press "n" to new file, open any file, e.g. ":e file.txt", then split window or open another file in window
  2. Resize windows (one bigger than other)
  3. Execute :qa
  4. Open nvim again, press "s" to restore session (the windows has equal sizes, not one bigger than other like before you leave)

Expected Behavior

Windows preserve sizes when I leave using cmdpopup

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  { "folke/noice.nvim",
  opts = {}
  },
  -- add any other plugins here
  { "nvimdev/dashboard-nvim",
    opts = {
      theme = "doom",
      config = {
        center = {
          { action = "ene | startinsert",                 desc = " New file",        icon = " ", key = "n" },
          { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" },
        },
      },
    }
  },
  {
    "folke/persistence.nvim",
    event = "BufReadPre",
    opts = { options = vim.opt.sessionoptions:get() },
  },
  {
    "MunifTanjim/nui.nvim", lazy = true
  },
} 
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
vim.opt.laststatus = 3
vim.opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" }
vim.keymap.set("n", "<c-q>", "<cmd>qa<cr>", { desc = "Quit all" })

vurtune avatar Jan 03 '24 22:01 vurtune