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: Binding scroll up/down does not work in some cases. #917

Open
4 tasks done
kuukunen opened this issue Dec 18, 2024 · 0 comments
Open
4 tasks done

bug: Binding scroll up/down does not work in some cases. #917

kuukunen opened this issue Dec 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@kuukunen
Copy link

Did you check docs and existing issues?

  • I have read all the which-key.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • 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)

v0.10.2

Operating system/version

Rocky Linux release 9.2 (Blue Onyx)

Describe the bug

This is follow-up to #897, because I didn't do a good enough job of explaining the problem. I was trying to demonstrate the core of the bug with the minimal configuration, but the main problem caused by the bug is that it is impossible to bind scroll down/up keys to the same keys for the which-key menus as normal mode. (It works in SOME menus, but not all.)

Steps To Reproduce

With scrolling bound to and for both normal mode and for which-key:

  1. Optional: G to the bottom of a large enough file to make the which-key menu smaller.
  2. Press to open the menu for
  3. Scrolling the which-key menu with and works.
  4. Press to go back to the "main menu", or whatever it is called.
  5. This time pressing or closes the menu, making it impossible to scroll.

Expected Behavior

I would expect it to be possible to scroll all the menus, not just some of them.

Health

which-key: require("which-key.health").check()

- OK Most of these checks are for informational purposes only.
  WARNINGS should be treated as a warning, and don't necessarily indicate a problem with your config.
  Please DON'T report these warnings as an issue.

Checking your config
- WARNING mini.icons is not installed
- WARNING nvim-web-devicons is not installed
- WARNING Keymap icon support will be limited.

Checking for issues with your mappings
- OK No issues reported

checking for overlapping keymaps
- WARNING In mode n, <gc> overlaps with <gcc>:
  - <gc>: Toggle comment
  - <gcc>: Toggle comment line
- OK Overlapping keymaps are only reported for informational purposes.
  This doesn't necessarily mean there is a problem with your config.

Checking for duplicate mappings
- OK No duplicate mappings found

Log

Debug Started for v3.15.0
{
  branch = "main",
  commit = "8ab96b38a2530eacba5be717f52e04601eb59326"
}
new Mode(n:1)
Trigger(add) Mode(n:1) " ` ' g' g` z= ] [ <Space> <C-W> g z
on_key: G
on_key: <Space>
State(start): Mode(n:0) Node(<Space>) { keys = "<Space>" }
  update Mode(n:1)
  continue: <Space> Mode(n:1)
  getchar
  on_key: <NL>
  got: <NL>
  getchar
  on_key: <C-K>
  got: <C-K>
  getchar
  on_key: <BS>
  got: <BS>
  getchar
  on_key: <NL>
  got: <NL>
  suspend: Mode(n:1)
  Trigger(del) Mode(n:1) ' g' g` z= ] [ <Space> <C-W> " z ` g
  feedkeys: Mode(n:1) <NL>
on_key: <NL>
Trigger(add) Mode(n:1) " ` ' g' g` z= ] [ <Space> <C-W> g z
on_key: :
ModeChanged(n:c)
  new Mode(c:1)
  Safe(true)
Trigger(add) Mode(c:1) <C-R>
on_key: q
on_key: <CR>
ModeChanged(c:n)
  Unsafe(command-mode)
  suspend: Mode(n:1)
  Trigger(del) Mode(n:1) ' g' g` z= ] [ <Space> <C-W> " z ` g
Trigger(add) Mode(n:1) " ` ' g' g` z= ] [ <Space> <C-W> g z

Repro

vim.g.mapleader = " "
-- To populate the menu:
vim.keymap.set("n", "<leader>y", ":yyy", {})

vim.keymap.set("n", "<C-j>", "<C-d>", { noremap = true })
vim.keymap.set("n", "<C-k>", "<C-u>", { noremap = true })

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 = {
        debug = true,
        keys = {
          scroll_down = "<c-j>",
          scroll_up = "<c-k>",
        },
      },
    },
  },
})
@kuukunen kuukunen added the bug Something isn't working label Dec 18, 2024
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

No branches or pull requests

1 participant