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.49k stars 175 forks source link

bug: popup displayed off-screen when editing long lines in diff mode #841

Closed dlyongemallo closed 1 month ago

dlyongemallo commented 2 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.10.0

Operating system/version

Ubuntu 22.04

Describe the bug

When editing a file with a long line in diff mode, the popup goes off the left side of the screen if the buffer is scrolled to the right (i.e., if the cursor is at a horizontal position larger than the screen width).

Steps To Reproduce

  1. Diff a file (nvim -d) with a line longer than the width of the display and ":nowrap" (e.g., 120 characters on a 80 character display).
  2. Go to the end of the line (or any position past 80).
  3. Activate the WhichKey popup (press ', ", or run :WhichKey).

Expected Behavior

Expected: popup is shown visably at bottom of display (aligned with left of display)

Actual: popup is shown aligned with left of text, so that it is partially or completely off-screen (depending on cursor positon)

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
- OK |nvim-web-devicons| is installed

Checking for issues with your mappings ~
- OK No issues reported

checking for overlapping keymaps ~
- WARNING In mode `n`, <m> overlaps with <m3>, <m2>, <m;>, <m1>, <m0>, <m{>, <m,>, <m}>, <m9>, <m8>, <m7>, <m6>, <m5>, <m:>, <m[>, <m]>, <m4>:

- WARNING In mode `n`, <dm> overlaps with <dm->, <dm2>, <dm8>, <dm9>, <dm0>, <dm<Space>>, <dm7>, <dm6>, <dm5>, <dm3>, <dm1>, <dm=>, <dm4>:

- WARNING In mode `n`, <gb> overlaps with <gbc>:
  - <gb>: Comment toggle blockwise
  - <gbc>: Comment toggle current block
- WARNING In mode `n`, <gc> overlaps with <gco>, <gcO>, <gcc>, <gcA>:
  - <gc>: Comment toggle linewise
  - <gco>: Comment insert below
  - <gcO>: Comment insert above
  - <gcc>: Comment toggle current line
  - <gcA>: Comment insert end of line
- WARNING In mode `n`, <\t> overlaps with <\ts>, <\to>, <\tM>, <\tm>, <\tO>:
  - <\ts>: Neotest summary
  - <\to>: Show test output
  - <\tM>: Test current method (DAP)
  - <\tm>: Test current method
  - <\tO>: Show test output panel
- WARNING In mode `x`, <\t> overlaps with <\ts>, <\to>, <\tM>, <\tm>, <\tO>:
  - <\ts>: Neotest summary
  - <\to>: Show test output
  - <\tM>: Test current method (DAP)
  - <\tm>: Test current method
  - <\tO>: Show test output panel
- WARNING In mode `s`, <\t> overlaps with <\ts>, <\to>, <\tM>, <\tm>, <\tO>:
  - <\ts>: Neotest summary
  - <\to>: Show test output
  - <\tM>: Test current method (DAP)
  - <\tm>: Test current method
  - <\tO>: Show test output panel
- 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.13.2
new Mode(n:1)
Trigger(add) Mode(n:1) ' " ` g` g' z= ] [ \ < <C-F> <Space> <C-W> g z <Plug>
on_key: $
on_key: :
ModeChanged(n:c)
  new Mode(c:1)
  Safe(true)
Trigger(add) Mode(c:1) <C-R>
on_key: w
on_key: <S-BS>
on_key: W
on_key: h
on_key: i
BufNew(3)
on_key: c
on_key: h
on_key: K
on_key: e
on_key: <Tab>
on_key: <CR>
ModeChanged(c:n)
  Unsafe(command-mode)
  suspend: Mode(n:1)
  Trigger(del) Mode(n:1) ] [ \ < <C-F> <Space> <C-W> g z ' " ` g` g' z= <Plug>
State(start): Mode(n:0) Node() { delay = 0, keys = "", mode = "n", waited = 1000 }
  update Mode(n:1)
  continue:  Mode(n:1)
  getchar
  Trigger(add) Mode(n:1) ' " ` g` g' z= ] [ \ < <C-F> <Space> <C-W> g z <Plug>
  on_key: :
  got: :
  suspend: Mode(n:1)
  Trigger(del) Mode(n:1) ] [ \ < <C-F> <Space> <C-W> g z ' " ` g` g' z= <Plug>
  feedkeys: Mode(n:1) :
on_key: :
ModeChanged(n:c)
  Safe(true)
Trigger(add) Mode(n:1) ' " ` g` g' z= ] [ \ < <C-F> <Space> <C-W> g z <Plug>
on_key: q
on_key: a
on_key: <CR>
ModeChanged(c:n)
  Unsafe(command-mode)
  suspend: Mode(n:1)
  Trigger(del) Mode(n:1) ] [ \ < <C-F> <Space> <C-W> g z ' " ` g` g' z= <Plug>
Trigger(add) Mode(n:1) ' " ` g` g' z= ] [ \ < <C-F> <Space> <C-W> g z <Plug>

Repro

-- using https://github.com/junegunn/vim-plug
local vim = vim
local Plug = vim.fn['plug#']

vim.call('plug#begin')
Plug('folke/which-key.nvim', {['tag'] = 'v3.13.2'})
vim.call('plug#end')
github-actions[bot] commented 1 month 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 1 month ago

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