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: <C-r> is not showing the contents of the register in telescope prompt #681

Closed
3 tasks done
yavorski opened this issue Jul 14, 2024 · 19 comments · Fixed by #688 or #713
Closed
3 tasks done

bug: <C-r> is not showing the contents of the register in telescope prompt #681

yavorski opened this issue Jul 14, 2024 · 19 comments · Fixed by #688 or #713
Labels
bug Something isn't working

Comments

@yavorski
Copy link

yavorski commented Jul 14, 2024

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

Operating system/version

Linux

Describe the bug

In previous version, when you were in telescope prompt pressing <C-r> in insert mode would show the which-key with the contents of the registers. Now this is showing something else.

Steps To Reproduce

  1. Open Telescope - find files for example
  2. Enter insert mode
  3. Press <C-r> to show the contents of registers, in order to select something

Expected Behavior

Show the contents of the register as before update

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.
- 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 `o`, <i> overlaps with <ii>:
  - <i>: inside
  - <ii>: Object scope
- WARNING In mode `o`, <a> overlaps with <ai>:
  - <a>: around
  - <ai>: Object scope with border
- WARNING In mode `x`, <i> overlaps with <ii>:
  - <i>: inside
  - <ii>: Object scope
- WARNING In mode `x`, <a> overlaps with <ai>, <a%>:
  - <a>: around
  - <ai>: Object scope with border
- WARNING In mode `n`, <gc> overlaps with <gcc>:
  - <gc>: Comment
  - <gcc>: Comment line
- WARNING In mode `n`, <sd> overlaps with <sdn>, <sdl>:
  - <sd>: Delete surrounding
  - <sdn>: Delete next surrounding
  - <sdl>: Delete previous surrounding
- WARNING In mode `n`, <sF> overlaps with <sFn>, <sFl>:
  - <sF>: Find left surrounding
  - <sFn>: Find next left surrounding
  - <sFl>: Find previous left surrounding
- WARNING In mode `n`, <sh> overlaps with <shn>, <shl>:
  - <sh>: Highlight surrounding
  - <shn>: Highlight next surrounding
  - <shl>: Highlight previous surrounding
- WARNING In mode `n`, <sf> overlaps with <sfn>, <sfl>:
  - <sf>: Find right surrounding
  - <sfn>: Find next right surrounding
  - <sfl>: Find previous right surrounding
- WARNING In mode `n`, <sr> overlaps with <srn>, <srl>:
  - <sr>: Replace surrounding
  - <srn>: Replace next surrounding
  - <srl>: Replace previous surrounding
- 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.3.0
on_key: <Space>
State(start): { "Mode(n)", "Node(<Space>)", { keys = "<Space>", update = true, waited = 0 } }
  getchar
  on_key: f
  got: f
  reattach: { "<Space>f", "n" }
  detach: <Space>
  feedkeys: { "Mode(n)", "<Space>f" }
on_key: <Space>f
ModeChanged(n:i)
not safe
attach: { "<Space>", "n" }
on_key: i
on_key: n
on_key: i
on_key: t
on_key: l
on_key: u
on_key: a
on_key: <CR>
ModeChanged(i:n)
not safe
on_key: <CR>
on_key: <Space>
State(start): { "Mode(n)", "Node(<Space>)", { keys = "<Space>", update = true, waited = 0 } }
  getchar
  on_key: f
  got: f
  reattach: { "<Space>f", "n" }
  detach: <Space>
  feedkeys: { "Mode(n)", "<Space>f" }
on_key: <Space>f
ModeChanged(n:i)
not safe
attach: { "<Space>", "n" }
on_key: <C-R>
State(start): { "Mode(i)", "Node(<C-R>)", { keys = "<C-R>", update = true, waited = 0 } }
  getchar
  on_key: <Esc>
  got: <Esc>
on_key: <Esc>
ModeChanged(i:n)
on_key: <Esc>
on_key: <Space>
State(start): { "Mode(n)", "Node(<Space>)", { keys = "<Space>", update = true, waited = 0 } }
  getchar
  on_key: f
  got: f
  reattach: { "<Space>f", "n" }
  detach: <Space>
  feedkeys: { "Mode(n)", "<Space>f" }
on_key: <Space>f
ModeChanged(n:i)
not safe
attach: { "<Space>", "n" }
on_key: i
on_key: n
on_key: i
on_key: t
on_key: l
on_key: u
on_key: a
on_key: <C-R>
State(start): { "Mode(i)", "Node(<C-R>)", { keys = "<C-R>", update = true, waited = 0 } }
  getchar
  on_key: <Esc>
  got: <Esc>
on_key: <Esc>
ModeChanged(i:n)
on_key: <Esc>
on_key: :
ModeChanged(n:c)
on_key: q
on_key: a
on_key: <CR>
ModeChanged(c:n)

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 = {} },
    -- add any other plugins here
    { "nvim-telescope/telescope.nvim", opts = {} },
  },
})
@yavorski yavorski added the bug Something isn't working label Jul 14, 2024
@yavorski
Copy link
Author

Adding screenshot

image

@folke folke closed this as completed in 26f6fd2 Jul 14, 2024
folke pushed a commit that referenced this issue Jul 15, 2024
🤖 I have created a release *beep* *boop*
---


##
[3.4.0](v3.3.0...v3.4.0)
(2024-07-15)


### Features

* added icons for function keys
([9222280](9222280))
* **mode:** allow certain modes to start hidden and only show after
keypress. See [#690](#690)
([b4fa48f](b4fa48f))
* **presets:** added gw
([09b80a6](09b80a6))
* **presets:** better padding defaults for helix preset
([4c36b9b](4c36b9b))
* **presets:** increase default height for helix
([df0ad20](df0ad20))
* simplified/documented/fixed mappings sorting. Closes
[#694](#694)
([eb73f7c](eb73f7c))
* **state:** skip mouse keys in debug
([5f85b77](5f85b77))
* **ui:** show keys/help in an overlay and added scrolling hint
([50b2c43](50b2c43))
* **view:** get parent icon if possible
([b9de927](b9de927))


### Bug Fixes

* **buf:** always detach " when executing keys. Fixes
[#689](#689)
([d36f722](d36f722))
* **config:** set expand=0 by default. Fixes
[#693](#693)
([89434aa](89434aa))
* **config:** warn when deprecated config options were used. Fixes
[#696](#696)
([81413ef](81413ef))
* **health:** move deprecated option check to health
([af7a30f](af7a30f))
* **mappings:** allow creating keymaps without desc. Fixes
[#695](#695)
([c442aaa](c442aaa))
* **plugins:** add existing keymaps to plugin view. Fixes
[#681](#681)
([26f6fd2](26f6fd2))
* **presets:** don't override title setting for classic. See
[#649](#649)
([9a53c1f](9a53c1f))
* **presets:** shorter descriptions
([20600e4](20600e4))
* **state:** always do full update on BufReadPost since buffer-local
keymaps would be deleted. Fixes
[#709](#709)
([6068887](6068887))
* **state:** don't show when coming from cmdline mode. Fixes
[#692](#692)
([8cba66b](8cba66b))
* **state:** honor timeoutlen and nowait. Fixes
[#648](#648). Closes
[#697](#697)
([80f20ee](80f20ee))
* **state:** properly disable which-key when recording macros. Fixes
[#702](#702)
([b506275](b506275))
* **state:** scrolling
([dce9167](dce9167))
* **tree:** rawget for existing plugin node children
([c77cda8](c77cda8))
* **util:** when no clipboard provider exists, use the " register as
default. Fixes
[#687](#687)
([d077a3f](d077a3f))
* **view:** disable footer on Neovim &lt; 0.10
([6d544a4](6d544a4))
* **view:** ensure highlights get set for title padding
([#684](#684))
([2e4f7af](2e4f7af))
* **view:** hide existing title/footer when no trail
([4f589a1](4f589a1))
* **view:** include group keymaps in expand results. See
[#682](https://github.com/folke/which-key.nvim/issues/682)
([39e703c](39e703c))
* **view:** overlap protection should keep at least 4 lines
([0d89475](0d89475))
* **view:** padding & column spacing. Fixes
[#704](#704)
([11eec49](11eec49))
* **view:** spacing when more than one box
([89568f3](89568f3))
* **view:** special handling of `&lt;NL&gt;/<C-J>`. Fixes
[#706](#706)
([f8c91b2](f8c91b2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@dpetka2001
Copy link

dpetka2001 commented Jul 15, 2024

@folke I'm hijacking this, since my problem is related, but when in insert mode and press <c-r> which-key menu doesn't pop up for the registers. When in command line pressing <c-r> correctly brings up the which-key menu for registers.

PS: related log with debug = true

Debug Started for v3.4.0
on_key: s
BufReadPost
BufEnter
on_key: i
ModeChanged(n:i)
not safe
on_key: <C-R>
on_key: <Esc>
on_key: <Esc>
ModeChanged(i:n)
on_key: :
ModeChanged(n:c)
on_key: <C-R>
State(start): { "Mode(c)", "Node(<C-R>)", { keys = "<C-R>", update = true, waited = 0 } }
  continue: { "<C-R>", "Mode(c)" }
  getchar
  on_key: <Esc>
  got: <Esc>
on_key: <Esc>
ModeChanged(c:n)
not safe
on_key: :
ModeChanged(n:c)
on_key: q
on_key: <CR>
ModeChanged(c:n)
not safe

@folke folke reopened this Jul 15, 2024
@folke
Copy link
Owner

folke commented Jul 15, 2024

@dpetka2001 I check this can't reproduce this with a minimal repro. Are you 100% you're up to date?

@yavorski
Copy link
Author

I am with latest, it does not open for me too.

image

@folke
Copy link
Owner

folke commented Jul 15, 2024

@yavorski ok, so in a new empty file?
What if you open a file and try then?

@dpetka2001
Copy link

@folke Yes, I'm up to date on latest which-key. But I just tried with a fresh LazyVim default installation and the issue does not occur. It works correctly there. Will try to find out what's wrong on my end.

@folke
Copy link
Owner

folke commented Jul 15, 2024

Be aware, that you need to have at least one register with a value in order for it to show.

@folke folke closed this as completed in 0f58176 Jul 15, 2024
@folke
Copy link
Owner

folke commented Jul 15, 2024

Currently wk would not attach to new buffers created with :enew, so without a filename, since BufRead doesn't trigger then.

Added an extra trigger on BufNew.

@yavorski
Copy link
Author

Actually just tried with a clean repro it is showing a warning and after that it is poping up, but it is not working with my own config a bit sad : ) ...

image

@yavorski
Copy link
Author

Currently wk would not attach to new buffers created with :enew, so without a filename, since BufRead doesn't trigger then.

Yes it is working with one register!

@dpetka2001
Copy link

Still doesn't work on my end. Here's a screencast of LazyVim default installation without any extra configuration

Screencast.2024-07-15.21.26.06.webm

@folke
Copy link
Owner

folke commented Jul 15, 2024

Can you reproduce it with the repro template?

@dpetka2001
Copy link

dpetka2001 commented Jul 15, 2024

No, with the minimal repro it works correctly.

PS: Just to make sure, you mean this one, right?

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 = {} },
    -- add any other plugins here
  },
})

@folke
Copy link
Owner

folke commented Jul 15, 2024

Can you list the exact steps that lead to the issue?

  • open lazyvim
  • press ....

@folke
Copy link
Owner

folke commented Jul 15, 2024

ok, can reproduce.
It's after restoring a session. That breaks it somehow. Will check

@dpetka2001
Copy link

Yes, I almost always use restore session in my workflow.

@dpetka2001
Copy link

But in the screencast I showed, I didn't restore session. I just used f from dashboard to open the init.lua file. So, maybe something with the dashboard in general?

@folke
Copy link
Owner

folke commented Jul 15, 2024

I added some extra debugging and it seems that when entering insert mode, there's always a <80> char pending for some reason.

Safe(false):pending "<80>"

Just pushed a fix that always ensures the mode is ready regardless of pending chars (which was causing the issue in this case)

Let me know if you'd still experience this issue.

@dpetka2001
Copy link

@folke With latest update it works correctly now. Thank you very much!!

folke pushed a commit that referenced this issue Jul 15, 2024
🤖 I have created a release *beep* *boop*
---


##
[3.5.0](v3.4.0...v3.5.0)
(2024-07-15)


### Features

* **api:** using wk.show() always assumes you want to see the group, and
not the actual mapping in case of overlap. Fixes
[#714](#714)
([f5067d2](f5067d2))


### Bug Fixes

* **state:** attach on BufNew as well. Fixes
[#681](#681)
([0f58176](0f58176))
* **state:** make sure mode always exists even when not safe. See
[#681](#681)
([7915964](7915964))


### Performance Improvements

* **plugin:** only expand plugins when needed
([1fcfc72](1fcfc72))
* **view:** set buf/win opts with eventignore
([e81e55b](e81e55b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

3 participants