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

bug: Extra characters "ff" appear after ':' when enter ":" in normal mode

Open fdelacruz opened this issue 6 months ago • 19 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-1858+g7e7da962d

Operating system/version

MacOs 10.15.7

Describe the bug

This only happens in the latest version of neovim v0.10.0-dev-1858+g7e7da962d where extra characters "ff" appear after ':' when enter ":" in normal mode. Screen Shot 2023-12-16 at 12 55 44 PM

No issue when noice is disabled.. Screen Shot 2023-12-16 at 12 56 31 PM

Steps To Reproduce

  1. enable noice
  2. hit Shift + :

Expected Behavior

Characters "ff" to not cloud the buffer replacing the cursor position.

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

fdelacruz avatar Dec 16 '23 12:12 fdelacruz

I would open an issue with Neovim, but this only happens when noice.nvim is enabled.

fdelacruz avatar Dec 21 '23 06:12 fdelacruz

I am seeing the same flicker ff too on a MacOs Monterey 12.7, I can reproduce with the above minimal repro.lua. It seems this only happens when running nightly: at the moment I am on NVIM v0.10.0-dev-2432+gacb13c7ac but the behaviour exists on many previous commits too (I haven't been able to find the specific commit yet).

gennaro-tedesco avatar Feb 24 '24 09:02 gennaro-tedesco

This might be a guicursor issue, does it happen when you set guicursor to an invisible highlight without noice?
e.g:

vim.api.nvim_set_hl(0,"HIDDEN",{blend = 100,nocombine = true})
vim.opt.guicursor = "a:HIDDEN"

I don't have MacOs to test this.

Sam-programs avatar Feb 24 '24 10:02 Sam-programs

does it happen when you set guicursor to an invisible highlight without noice?

Do you mean without enabling noice?

gennaro-tedesco avatar Feb 24 '24 11:02 gennaro-tedesco

Do you mean without enabling noice?

Yes.

Sam-programs avatar Feb 24 '24 11:02 Sam-programs

You are right, without enabling noice but setting the options as above the flicker ff still appears: you can reproduce with the following

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

vim.cmd.colorscheme("tokyonight")
vim.api.nvim_set_hl(0, "HIDDEN", { blend = 100, nocombine = true })
vim.opt.guicursor = "a:HIDDEN"
-- add anything else here

see recording below for demonstration

https://github.com/folke/noice.nvim/assets/15387611/5d5ebc24-65cf-482a-94ec-14655efb328b

gennaro-tedesco avatar Feb 24 '24 12:02 gennaro-tedesco

Is lazy or tokyonight needed here or can you reproduce it with just these 2 lines?

vim.api.nvim_set_hl(0, "HIDDEN", { blend = 100, nocombine = true })
vim.opt.guicursor = "a:HIDDEN"

Sam-programs avatar Feb 24 '24 12:02 Sam-programs

Is lazy or tokyonight needed here or can you reproduce it with just these 2 lines?

I confirm I can reproduce it with just those two lines with nvim --clean.

gennaro-tedesco avatar Feb 24 '24 13:02 gennaro-tedesco

You should make an issue to neovim, noice can't do anything about this.

Sam-programs avatar Feb 24 '24 14:02 Sam-programs

Are the options above part of the noice code explicitly? The issue does disappear when not using noice (and it only occurs on "old" MacOs architectures).

gennaro-tedesco avatar Feb 24 '24 14:02 gennaro-tedesco

Are the options above part of the noice code explicitly

What do you mean explicitly?, there is something close to the 2 lines in noice

Sam-programs avatar Feb 24 '24 14:02 Sam-programs

https://github.com/folke/noice.nvim/blob/bf67d70bd7265d075191e7812d8eb42b9791f737/lua/noice/util/hacks.lua#L249-L260

This is called at the start of the command-line, and NoiceHiddenCursor is the same as the HIDDEN highlight in the 2 lines.

Sam-programs avatar Feb 24 '24 14:02 Sam-programs

I see, I will address it to neovim, thank you for the explanation!

gennaro-tedesco avatar Feb 24 '24 14:02 gennaro-tedesco

Hi, i have found a workaround for iterm, set the report terminal type option to linux in preferences > profiles > terminal

tuga3d avatar Feb 24 '24 23:02 tuga3d

Nice!

fdelacruz avatar Feb 25 '24 00:02 fdelacruz

I have digged an old neovim issue here where the same problem was discussed already: it seems that the problem is that this happens whenever the highlight group to which the guicursor is set does not exist.

Using noice the vim.opt.guicursor defaults to a highlight group NoiceHiddenCursor which seems not to be defined anywhere (or am I wrong)? I cannot find it in the documentation nor do I see it in the highlight groups that are being used in my configuration. I have tried to override it, however it appears that it is being overridden once again by the plugin somewhen in the require calls.

Could I ask you the favour to check if such highlight group is defined to be anything in the plugin code and/or if setting it to anything else could get rid of the problem?

gennaro-tedesco avatar Apr 08 '24 10:04 gennaro-tedesco

check if such highlight group is defined to be anything in the plugin code

It's defined here: https://github.com/folke/noice.nvim/blob/0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12/lua/noice/config/highlights.lua#L107

Sam-programs avatar Apr 08 '24 19:04 Sam-programs

i’m sorry, what’s wrong with setting the report terminal type option to linux. It works.

Please excuse brevity/mistakes, message sent from my phone.

On Mon, Apr 8, 2024 at 3:01 PM Sam @.***> wrote:

check if such highlight group is defined to be anything in the plugin code

It's defined here:

https://github.com/folke/noice.nvim/blob/0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12/lua/noice/config/highlights.lua#L107

— Reply to this email directly, view it on GitHub https://github.com/folke/noice.nvim/issues/671#issuecomment-2043466213, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABEFAX6LTSHJH7RFRQMM3DY4LSSNAVCNFSM6AAAAABAXRLKBCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBTGQ3DMMRRGM . You are receiving this because you modified the open/close state.Message ID: @.***>

fdelacruz avatar Apr 09 '24 10:04 fdelacruz

i’m sorry, what’s wrong with setting the report terminal type option to linux. It works. Please excuse brevity/mistakes, message sent from my phone.

changing terminal type option to linux completely changes terminal behaviour on non-linux computers (colours, fonts, shell completions, cursor movement and so forth).

@Sam-programs thank you for addressing the issue on the neovim side with the PR: it seems now to be entirely solved with the latest merge on master (at least from my side).

gennaro-tedesco avatar Apr 09 '24 12:04 gennaro-tedesco