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.27k stars 165 forks source link

bug: scroll mappings not working in nvim 0.10 #515

Closed willothy closed 4 months ago

willothy commented 1 year ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.10.0-dev-1081+gf859d16ae

Operating system/version

Arch Linux, 6.4.12-arch1-1

Describe the bug

Scroll mappings do not work at all in the popup menu when running nvim 0.10 (master). They do work correctly in 0.9.

Steps To Reproduce

  1. Install which-key
  2. Create a long list of mappings under one key "namespace"
  3. Open the menu, and attempt to scroll to see hidden keys
  4. Nothing happens

Expected Behavior

The popup menu should scroll up/down when pressing <c-u> / <c-d>.

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

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

local wk = require("which-key")

-- big list of g mappings for convenience, since g is a builtin prefix
wk.register({
  g = {
    a = { "", "" },
    b = { "", "" },
    c = { "", "" },
    d = { "", "" },
    e = { "", "" },
    f = { "", "" },
    g = { "", "" },
    h = { "", "" },
    i = { "", "" },
    j = { "", "" },
    k = { "", "" },
    l = { "", "" },
    m = { "", "" },
    n = { "", "" },
    o = { "", "" },
    p = { "", "" },
    q = { "", "" },
    r = { "", "" },
    s = { "", "" },
    t = { "", "" },
    u = { "", "" },
    v = { "", "" },
    w = { "", "" },
    x = { "", "" },
    y = { "", "" },
    z = { "", "" },
    A = { "", "" },
    B = { "", "" },
    C = { "", "" },
    D = { "", "" },
    E = { "", "" },
    F = { "", "" },
    G = { "", "" },
    H = { "", "" },
    I = { "", "" },
    J = { "", "" },
    K = { "", "" },
    L = { "", "" },
    M = { "", "" },
    N = { "", "" },
    O = { "", "" },
    P = { "", "" },
    Q = { "", "" },
    R = { "", "" },
    S = { "", "" },
    T = { "", "" },
    U = { "", "" },
    V = { "", "" },
    W = { "", "" },
    X = { "", "" },
    Y = { "", "" },
    Z = { "", "" },
  },
})
willothy commented 1 year ago

Edit: found the offending upstream commit, merged with https://github.com/neovim/neovim/pull/24824.