flash.nvim
flash.nvim copied to clipboard
bug: Highlight does not update after call `jump({continue=true})` in action
Did you check docs and existing issues?
- [X] I have read all the flash.nvim docs
- [X] I have searched the existing issues of flash.nvim
- [X] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
v0.9.4
Operating system/version
Microsoft Windows 11 Home 10.0.22621 N/A Build 22621
Describe the bug
function flash_select_labels()
require("flash").jump({
label = {
format = function(opts)
return {
{ opts.match.label, opts.match.highlight and opts.hl_group or "FlashLabelChoosed" },
}
end,
},
action = function(match, state)
vim.cmd("echo '" .. tostring(match.highlight) .. tostring(match) .. "'")
match.highlight = not match.highlight
-- state:_update()
require("flash").jump({ continue = true })
end,
})
end
The highlight of matches and labels doesn't change when I choose them. I'm not sure if this is expected behavior, the highlight update function _update()
is called after action, but I've called another jump in action, so the _update()
will not be called.
Steps To Reproduce
- call the function
flash_select_labels
above - type, says
pattern
, to search word - flash show labels after every
pattern
- type a label char, says
a
- the highlight of match
pattern
and labela
doesn't change
Expected Behavior
The match pattern
should not highlight and label a
should changes to highlight group FlashLabelChoosed
when I choose the label a
.
Repro
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{ "folke/flash.nvim", opts = {} },
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here