Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: scroll mappings not working in nvim 0.10 #515

Open
3 tasks done
willothy opened this issue Sep 11, 2023 · 1 comment · May be fixed by #516
Open
3 tasks done

bug: scroll mappings not working in nvim 0.10 #515

willothy opened this issue Sep 11, 2023 · 1 comment · May be fixed by #516
Labels
bug Something isn't working

Comments

@willothy
Copy link

Did you check docs and existing issues?

  • I have read all the which-key.nvim docs
  • I have searched the existing issues of which-key.nvim
  • I have searched the existing issues of plugins related to this issue

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 willothy added the bug Something isn't working label Sep 11, 2023
@willothy
Copy link
Author

Edit: found the offending upstream commit, merged with neovim/neovim#24824.

willothy added a commit to willothy/which-key.nvim that referenced this issue Sep 11, 2023
problem: as of neovim/neovim#24824 buf_set_lines adjusts topline differently, which breaks scrolling in the which-key menu.
solution: save and restore view when rendering to ensure that the render does not change scroll position.

fixes folke#515
@willothy willothy linked a pull request Sep 11, 2023 that will close this issue
willothy added a commit to willothy/which-key.nvim that referenced this issue Sep 11, 2023
problem: as of neovim/neovim#24824 buf_set_lines adjusts topline differently, which breaks scrolling in the which-key menu.
solution: save and restore view when rendering to ensure that the render does not change scroll position.

fixes folke#515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant