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

bug: Noice breaks when entering %s replace mode.

Open shanyssys opened this issue 1 year ago • 1 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
  • [X] I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.10.0-dev-931f288

Operating system/version

Windows 11

Describe the bug

When entering a cmd mode with : I want to replace text in the file using %s command. The moment you add the character / then the quicklist window is open, showing matches, but then every character you type after the / is being screwed up and won't show. Trying to delete backward is even worse as it deletes the wrong characters.

https://github.com/folke/noice.nvim/assets/129735055/cb39ef21-5c1e-4375-a80f-d11805ec11bc

Steps To Reproduce

  1. Open a file / new buffer
  2. press : (cmd popup will show)
  3. enter %s/test/

Expected Behavior

the expected behavior is that the text should be replaced without stuttering test and missing characters.

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",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

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

shanyssys avatar Jan 27 '24 07:01 shanyssys

I'm having the same problem; in my testing it seems that entering any replace mode, either for single line, region or whole buffer, as soon as the first / is typed what the command line displays appears to be one keystroke behind what the user is typing.

For instance, typing :s/ab displays :s/a. Same goes for deletion operations: when <backspace> is pressed nothing happens until the next keystroke when the deletion displays.

I tried playing around a bit with the config disabling some of the options in cmdline but nothing seems to help.

In my case:

Nvim version

NVIM v0.10.0-dev-2284+gf6042d5c3

Operating system

Windows 10 (build 19045.3930)

Miniamal config

local lazypath = vim.fn.stdpath("data") .. "/lazy/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",
		"--branch=stable", -- latest stable release
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
	"folke/noice.nvim",
	event = "VeryLazy",
	dependencies = {
		"MunifTanjim/nui.nvim",
		"rcarriga/nvim-notify",
	},
})

require("noice").setup({})

MicheleQuasar avatar Feb 07 '24 09:02 MicheleQuasar

@shanyssys @MicheleQuasar Have either of you had any luck figuring out a solution or workaround for this?

JustBarnt avatar Apr 25 '24 13:04 JustBarnt

Is this issue for the cmdline replace mode (:h c_<Insert>) ? Or is "replace mode" the substitute command ?

Sam-programs avatar Apr 25 '24 14:04 Sam-programs

I notice the issue whenever I'm doing a substitute, whether that is s/ or %s/

JustBarnt avatar Apr 25 '24 14:04 JustBarnt