nvim-lua / kickstart.nvim

A launch point for your personal nvim configuration
MIT License
20.06k stars 24.43k forks source link

Error when yanking a V-block with lines containing utf-8 chars #28

Closed kontza closed 2 years ago

kontza commented 2 years ago

Hi,

I noticed the following with my fork of kickstart.nvim (and verified with a vanilla init.lua from this repo):

I have the following minimal markdown:

# Introduction
- päivitettävä uudempaan; test
- päivitettävä uudempaan; edu

If I C-v and select a rectangular region from upper "uudempaan" to the end of "edu", and yank the selection, I get an error:

Error detected while processing TextYankPost Autocommands for "*":
Error executing lua callback: vim/_editor.lua:0: index out of range
stack traceback:
        [C]: in function 'str_byteindex'
        vim/_editor.lua: in function 'region'
        ...ar/neovim/0.8.0/share/nvim/runtime/lua/vim/highlight.lua:51: in function 'range'
        ...ar/neovim/0.8.0/share/nvim/runtime/lua/vim/highlight.lua:129: in function 'on_yank'
        /Users/self/.config/nvim/init.lua:115: in function </Users/juharu/.config/nvim/init.lua:114>

Note that I do not need to select "päivitettävä" word, it only need to exist on the line. While pasting the above error, I noticed that str_byteindex is the point of error. The problematic word contains ä, which is a two byte 'character'. My guess, without knowing nothing about the implementation is that that function should take into account utf-8 characters.

ps. "päivitettävä" is a Finnish word for "to be updated".

tjdevries commented 2 years ago

Hmm... does this still happen with latest nvim? This seems like an upstream bug.

tjdevries commented 2 years ago

woops, just meant to comment, not close. Sorry about that.

kontza commented 2 years ago

Hmm... does this still happen with latest nvim? This seems like an upstream bug.

This left me dumbfounded... Nightly or stable? Therefore I tried both:

Therefore I'm closing this as a fix is on the way (with the future 0.9.0 stable).

(Edit: newline added to separate my own text from the quoted text.)

tjdevries commented 2 years ago

Awesome, thanks for reporting :)