fix(which-key): show delayed popup before blocking input#1058
Open
AndreaCovelli wants to merge 1 commit into
Open
fix(which-key): show delayed popup before blocking input#1058AndreaCovelli wants to merge 1 commit into
AndreaCovelli wants to merge 1 commit into
Conversation
which-key starts the popup timer and then immediately blocks in getcharstr(). In some split-window flows that leaves the delayed popup waiting until timeoutlen expires. Wait for the delayed popup window before entering the blocking read, while still bailing out immediately if the user already typed the next key.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
schedulefilter field used by the forced refreshReproduction
<leader>in the second split.timeoutlenexpires, even though the same mapping is immediate in the first window.In my repro this showed up consistently when opening one buffer first and then creating the second split, but not when starting Neovim directly with
-O.Root cause
which-key.state.start()schedulesView.update()and then immediately blocks ingetcharstr(). In the affected split-window flow the timer-backed popup refresh does not get a chance to render before that blocking read.This change waits until the popup delay elapses, while polling
getcharstr(1)so a pending next key is not consumed. If no follow-up key arrives, it forces an immediateView.update({ schedule = false })before entering the blocking read.Validation
nvim --headless -u NONE --cmd 'set rtp+=/tmp/which-key.nvim' '+lua require("which-key.state")' '+qa'git diff --checkTesting note
Full test suite and stylua pass locally (Neovim v0.12.2, stylua 2.5.2):
--check lua/ tests/all files formatted correctlybuf_spec.lua,layout_spec.lua,mappings_spec.lua,util_spec.lua