folke / which-key.nvim

💥 Create key bindings that stick. WhichKey helps you remember your Neovim keymaps, by showing available keybindings in a popup as you type.
Apache License 2.0
5.12k stars 163 forks source link

bug: cursor moves visually when lualine winbar is enabled #659

Closed zspher closed 1 month ago

zspher commented 1 month ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.10.0

Operating system/version

NixOS 24.11

Describe the bug

when pressing y, c cursor moves visually. Only happens when lualine winbar is active

https://github.com/user-attachments/assets/64262eea-e3c8-433c-9496-721a6689ab37

Steps To Reproduce

  1. open a file
  2. press c

Expected Behavior

cursor shouldn't move visually

Health

No response

Log

No response

Repro

vim.env.LAZY_STDPATH = ".repro"
load(
    vim.fn.system "curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"
)()

require("lazy.minit").repro {
    spec = {
        { "folke/which-key.nvim", opts = {} },
        {

            "nvim-lualine/lualine.nvim",
            opts = function(_, opts)
                opts.winbar = {
                    lualine_c = {
                        {
                            "filename",
                            path = 3,
                            symbols = {
                                modified = "",
                                readonly = "",
                                unnamed = "",
                                newfile = "",
                            },
                        },
                    },
                }
            end,
        },
    },
}
folke commented 1 month ago

That's not which-key though. I also noticed in the repro that the winbar is shown at the bottom under the statusline.

zspher commented 1 month ago

@folke this doesn't happen when set which-key to version "2.1.0" tho.

I've also noticed that in v3 the lualine statusline is overwritten by the which-key ui while in v2.1.0 the which-key ui is placed above the statusline.

checked with the ff repro

```lua local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then -- bootstrap lazy.nvim vim.fn.system { "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath, } end vim.opt.rtp:prepend(vim.env.LAZY or lazypath) require("lazy").setup { spec = { -- { "LazyVim/LazyVim", import = "lazyvim.plugins" }, { "folke/which-key.nvim", opts = {}, -- version = "2.1.0" }, { "nvim-lualine/lualine.nvim", -- opts = {}, opts = function(_, opts) opts.winbar = { lualine_c = { { "filename", path = 3, symbols = { modified = "", readonly = "", unnamed = "", newfile = "", }, }, }, } end, }, }, defaults = { -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. lazy = false, -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, -- have outdated releases, which may break your Neovim install. version = false, -- always use the latest git commit -- version = "*", -- try installing the latest stable version for plugins that support semver }, checker = { enabled = true, notify = false }, -- automatically check for plugin updates performance = { rtp = { -- disable some rtp plugins, add more to your liking disabled_plugins = { "gzip", "netrwPlugin", "tarPlugin", "tohtml", "zipPlugin", "tutor", }, }, }, } ```
zspher commented 1 month ago

https://github.com/user-attachments/assets/8075e3eb-5f99-4160-9ff5-1ed3396bf9d4

https://github.com/user-attachments/assets/7ec37fe7-bdd3-41a2-a7f9-8e06bd32e010

folke commented 1 month ago

I get it, but still not a which-key issue. I'm not doing anything special with the floating window.

zspher commented 1 month ago

figured it out, not a which-key issue, had to set lualine winbar and inactive_winbar focus on floating windows including which-key are inactive_winbar