Open
Conversation
When 'lazyredraw' is on, hydra hints don't always render correctly in
the cmdline. Specifically, the hint will render correctly when first
invoking the hydra, but any subsequent actions cause a block cursor to
appear at the end of the hint (and disappear from the active window).
This can be demonstrated (prior to this commit) by invoking nvim like,
nvim -u minimal.lua +'call append(0, "1234")' +'goto 1'
with the following minimal.lua init file:
vim.opt.lazyredraw = true
vim.opt.wrap = false -- allow horizontal scrolling
local hydra = require('hydra')
hydra({
name = 'scroll',
mode = 'n',
body = 'z',
heads = { { 'l', 'zl' }, { 'h', 'zh' } },
config = { hint = { type = 'cmdline' } },
})
Type 'zl' to invoke the hydra, and the hint is drawn correctly. Type
either 'l' or 'h' to scroll again, and now the cursor is drawn to the
right of the hint in the echo area.
ivanbrennan
added a commit
to ivanbrennan/nixbox
that referenced
this pull request
Feb 13, 2023
Using my fork to address lazyredraw issue. See anuvyklack/hydra.nvim#76
|
Just don't set |
Author
|
@folke Some users set Your point is valid, and this is a bit beyond the plugin's responsibility. But I think it's worth mentioning the issue (and solution) in the docs. I ended up bisecting my configuration before finally identifying |
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.
Fix a rendering issue that causes the cursor to appear at the end of the hint if
lazyredrawis enabled and hint is shown in the echo area.Problem
If a hydra shows its hint in the echo area (

config.hint.type = 'cmdline') and the user haslazyredrawon, the hint renders correctly when first invoked, but any subsequent action (within the hydra) causes the cursor to appear at the end of the hint.Solution
Add an
on_enterfunction to the default config to turnlazyredrawoff for the duration of the hydra.Minimal reproducible example
The problem can be demonstrated (prior to this commit) by invoking nvim like,
with the following minimal.lua init file:
Type

zlto invoke the hydra, and the hint is drawn correctly.Type

lto scroll again, and now the cursor is drawn at the end of the hint.