Closed altermo closed 2 months ago
I haven't been able to reproduce the index out of range
error, if possible could you give steps?
I am noticing buggy behavior when dealing with non-ASCII characters, though the switch from utf-16
to utf-8
didn't seem to fix any of the bugs - from the looks of it the applied range doesn't use utf-8
either, but rather the byte offset which is still inconsistent for non-ASCII characters
Reproducible steps:
¿
If possible could you give the version of Nvim and operating system you are using? I wasn't able to reproduce this, inserting ¿
and accepting a completion works as expected, inserting ¿Qué es el área de la Ciudad de México?
with no issues.
Typing ¿¿
and accepting a completion results in a long series of ¿¿¿¿¿¿
but no error in this case either.
I also wasn't able to reproduce it. I also changed it to utf-8
and was behaving the same way. If I write a comment in lua like -- ¿
supermaven suggests ¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿
but no errors either.
https://github.com/user-attachments/assets/ffc7d55c-5801-4866-a514-7fa9431980e0
NeoVim version:
NVIM v0.10.1
Build type: RelWithDebInfo
LuaJIT 2.1.1713484068
Sorry, I forgot to tell you I'm running the development build... I looked through the blame and the neovim PR that makes this error happen is https://github.com/neovim/neovim/pull/30288. I would recommend merging this (or solving the problem another way) as the neovim commit has been backported to 0.10 (see https://github.com/neovim/neovim/pull/30308)
I don't know if v0.9 will cause some trouble or not, I can't test that until next week though, if someone can test that still works with utf-8
then wouldn't hurt to merge the PR.
Adding vim.fn.has(nvim-0.10.0)
and changing the encoding depending on that would be nice too if there is a problem with using utf-8
over utf-16
.
I tested and it works with v0.9.4
.
Problem: When the current line contains specific non-ASCII characters, there's an
index out of range
error. Cause: Theoffset_encoding
is set toutf-16
while the applied range usesutf-8
compatible indexing. Solution: useutf-8
foroffset_encoding