-
Notifications
You must be signed in to change notification settings - Fork 261
Description
Contributing guidelines
- I have read CONTRIBUTING.md
- I have read CODE_OF_CONDUCT.md
- I have updated 'mini.nvim' to latest version of the
main
branch
Module(s)
mini.map, mini.surround
Neovim version
0.11.x
Description
When running :checkhealth
, the following warning is present:
- ⚠️ WARNING vim.str_utfindex is deprecated. Feature will be removed in Nvim 1.0
- ADVICE:
- use vim.str_utfindex(s, encoding, index, strict_indexing) instead.
- stack traceback:
.../mini.map/lua/mini/map.lua:1687
.../mini.map/lua/mini/map.lua:600
.../mini.map/lua/mini/map.lua:576
According to the latest docs in 0.11.x, the second parameter into this function is expected to be the desired encoding explicitly set. The full discussion on why this was made is from neovim/neovim#30735
In the context of its usage in mini.map, this could be guarded by a version check and then call the function with "utf-32
" as the encoding to use.
local res = vim.fn.has('nvim-0.11') == 1 and vim.str_utfindex(x, 'utf-32') or vim.str_utfindex(x)
I can put in a PR to implement this change as the comment above the call makes it clear the UTF-32 value is the desired one. If this is the same across other uses of the function, we can do a similar pattern until mini.nvim drops support for < 0.11. Thank you for all the work you put in!
Reproduction
-
Update
mini.map
(or any other module using this function which includes: diff, pick, align, surround, etc.) to the latest main. -
Run
:checkhealth
-
There will be many stack traces in the
vim.deprecated
section pointing tomini.map/lua/mini/map.lua:1687
:
https://github.com/echasnovski/mini.nvim/blob/5495dd5480843148b0e9ed57b42d32ea47ac2b52/lua/mini/map.lua#L1685-L1689