folke / noice.nvim

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

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

Closed fdelacruz closed 3 months ago

fdelacruz commented 10 months ago

Did you check docs and existing issues?

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 commented 10 months ago

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

gennaro-tedesco commented 7 months ago

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).

Sam-programs commented 7 months ago

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.

gennaro-tedesco commented 7 months ago

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

Do you mean without enabling noice?

Sam-programs commented 7 months ago

Do you mean without enabling noice?

Yes.

gennaro-tedesco commented 7 months ago

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

Sam-programs commented 7 months ago

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"
gennaro-tedesco commented 7 months ago

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.

Sam-programs commented 7 months ago

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

gennaro-tedesco commented 7 months ago

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).

Sam-programs commented 7 months ago

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 commented 7 months ago

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.

gennaro-tedesco commented 7 months ago

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

tuga3d commented 7 months ago

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

fdelacruz commented 7 months ago

Nice!

gennaro-tedesco commented 6 months ago

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?

Sam-programs commented 6 months ago

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

fdelacruz commented 6 months ago

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: @.***>

gennaro-tedesco commented 6 months ago

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).

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 3 months ago

This issue was closed because it has been stalled for 7 days with no activity.