folke / noice.nvim

💥 Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu.
Apache License 2.0
3.95k stars 88 forks source link

bug: `E565: Not allowed to change text or change window` error when using with clever-f.vim #824

Open Frederick888 opened 1 month ago

Frederick888 commented 1 month ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.10.0

Operating system/version

macOS 14.5

Describe the bug

When using with https://github.com/rhysd/clever-f.vim, I sometimes see this error:

Error detected while processing function clever_f#find_with[97]..function clever_f#find_with[44]..<SNR>27_getchar:
line    2:
Error executing vim.schedule lua callback: ...frederick/.repro/plugins/nui.nvim/lua/nui/popup/border.lua:577: E565: Not allowed to change text or change window
stack traceback:
        [C]: in function 'nvim_buf_delete'
        ...frederick/.repro/plugins/nui.nvim/lua/nui/popup/border.lua:577: in function 'unmount'
        ...frederick/.repro/plugins/nui.nvim/lua/nui/popup/init.lua:320: in function 'unmount'
        ...frederick/.repro/plugins/noice.nvim/lua/noice/view/nui.lua:197: in function <...frederick/.repro/plugins/noice.nvim/lua/noice/view/nui.lua:193>

The mini view gets stuck from time to time after this error.

Steps To Reproduce

  1. Run nvim -u repro.lua repro.lua
  2. Immediately hit dt (this stops mini views from popping up somehow)
  3. Wait for one second or two, then hit another key

Expected Behavior

No errors.

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",
  "MunifTanjim/nui.nvim",
  "folke/noice.nvim",
  "rhysd/clever-f.vim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

require("noice").setup({
  lsp = {
    -- override markdown rendering so that **cmp** and other plugins use **Treesitter**
    override = {
      ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
      ["vim.lsp.util.stylize_markdown"] = true,
      ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
    },
  },
  -- you can enable a preset for easier configuration
  presets = {
    bottom_search = true, -- use a classic bottom cmdline for search
    command_palette = true, -- position the cmdline and popupmenu together
    long_message_to_split = true, -- long messages will be sent to a split
    inc_rename = false, -- enables an input dialog for inc-rename.nvim
    lsp_doc_border = false, -- add a border to hover docs and signature help
  },
})

local timer = vim.uv.new_timer()
local counter = 1
vim.uv.timer_start(timer, 1000, 1000, function ()
  vim.notify('hello, world! ' .. counter)
  counter = counter + 1
end)