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: (NFA regexp) Misplaced * #94

Closed
3 tasks done
gennaro-tedesco opened this issue Jun 29, 2023 · 1 comment · Fixed by #86
Closed
3 tasks done

bug: (NFA regexp) Misplaced * #94

gennaro-tedesco opened this issue Jun 29, 2023 · 1 comment · Fixed by #86
Labels
bug Something isn't working

Comments

@gennaro-tedesco
Copy link

Did you check docs and existing issues?

  • I have read all the flash.nvim docs
  • I have searched the existing issues of flash.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.10.0-dev-597+gaa362a2af-Homebrew

Operating system/version

macOS 13.4.0 Ventura

Describe the bug

I found out by accident (by mistyping an actual search 😆) that searching the character * generates the following error:

CmdlineChanged Autocommands for "*": Vim(append):Error executing lua callback: .../.local/share/nvim/lazy/flash.nvim/lua/flash/labeler.lua:174: Error executing lua: Vim:E866: (NFA regexp) Misplaced *
stack traceback:
	[C]: in function 'searchpos'
	.../.local/share/nvim/lazy/flash.nvim/lua/flash/labeler.lua:183: in function <.../.local/share/nvim/lazy/flash.nvim/lua/flash/labeler.lua:174>
	[C]: in function 'nvim_win_call'
	.../.local/share/nvim/lazy/flash.nvim/lua/flash/labeler.lua:174: in function 'skip'
	.../.local/share/nvim/lazy/flash.nvim/lua/flash/labeler.lua:58: in function 'reset'
	.../.local/share/nvim/lazy/flash.nvim/lua/flash/labeler.lua:24: in function 'labeler'
	...ro/.local/share/nvim/lazy/flash.nvim/lua/flash/state.lua:269: in function '_update'
	...ro/.local/share/nvim/lazy/flash.nvim/lua/flash/state.lua:222: in function 'update'
	.../share/nvim/lazy/flash.nvim/lua/flash/plugins/search.lua:56: in function 'update'
	.../share/nvim/lazy/flash.nvim/lua/flash/plugins/search.lua:86: in function <.../share/nvim/lazy/flash.nvim/lua/flash/plugins/search.lua:85>
stack traceback:
	[C]: in function 'nvim_win_call'
	.../.local/share/nvim/lazy/flash.nvim/lua/flash/labeler.lua:174: in function 'skip'
	.../.local/share/nvim/lazy/flash.nvim/lua/flash/labeler.lua:58: in function 'reset'
	.../.local/share/nvim/lazy/flash.nvim/lua/flash/labeler.lua:24: in function 'labeler'
	...ro/.local/share/nvim/lazy/flash.nvim/lua/flash/state.lua:269: in function '_update'
	...ro/.local/share/nvim/lazy/flash.nvim/lua/flash/state.lua:222: in function 'update'
	.../share/nvim/lazy/flash.nvim/lua/flash/plugins/search.lua:56: in function 'update'
	.../share/nvim/lazy/flash.nvim/lua/flash/plugins/search.lua:86: in function <.../share/nvim/lazy/flash.nvim/lua/flash/plugins/search.lua:85>
E315: ml_get: Invalid lnum: 245

By quickly glancing and the stacktrace probably this is due to incomplete escaping of the regex here?

Notice that by correctly escaping the * character during search (say \*) the error does not occur, and nor does it against any other special regex wildcard (I tried a few and all seems to work well); as such, this is probably such a minimal case that it may not be even worth looking into it (however I thought I would flag it anyway).

Steps To Reproduce

  1. search for *
  2. the error occurs

Expected Behavior

If I am not mistaken searching for * brings you to the character even if not escaped in standard vim, so I would expect the same behaviour here too (or am I wrong)?

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
@gennaro-tedesco gennaro-tedesco added the bug Something isn't working label Jun 29, 2023
@gennaro-tedesco gennaro-tedesco changed the title bug: bug: (NFA regexp) Misplaced * Jun 29, 2023
@folke folke closed this as completed in 1fff746 Jun 29, 2023
@folke
Copy link
Owner

folke commented Jun 29, 2023

Fixed! :)

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.

2 participants