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

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

Open
2 of 3 tasks
vurtune opened this issue Jan 3, 2024 · 1 comment
Open
2 of 3 tasks
Labels
bug Something isn't working

Comments

@vurtune
Copy link

vurtune commented Jan 3, 2024

Did you check docs and existing issues?

  • I have read all the noice.nvim docs
  • 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 vurtune added the bug Something isn't working label Jan 3, 2024
@vurtune vurtune changed the title issue: window resized when I open cmdpopup issue: window resized in session when open cmdpopup before leave nvim Jan 4, 2024
@kierun
Copy link

kierun commented Jun 10, 2024

Here is the GIF showing the issue.

nvim-contour-bug

However, I could not reproduce the bug with either urzvt, gnome-terminal, or alacritty… 🤔

I opened MunifTanjim/nui.nvim/issues/370 because if I disable the import of nui, the issue disappears while noice still works after an initial warning/error.

I am happy to test development branches if that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants