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

Support for multibyte characters like CJK characters #137

Open
gkzhb opened this issue Mar 11, 2022 · 2 comments
Open

Support for multibyte characters like CJK characters #137

gkzhb opened this issue Mar 11, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@gkzhb
Copy link

gkzhb commented Mar 11, 2022

I use Chinese a lot, so frequently I want to jump to a position between Chinese characters.

For example, with the content of

经过上述讨论,生活的意义,发生了会如何,不发生又会如何。生活的意义因何而发生?既然如此,生活的意义的发生,到底需要如何做到,不生活的意义的发生,又会如何产生。可是,即使是这样,生活的意义的出现仍然代表了一定的意义。那么,经过上述讨论,这种事实对本人来说意义重大,相信对这个世界也是有一定意义的。生活中,若生活的意义出现了,我们就不得不考虑它出现了的事实。而这些并不是完全重要,更加重要的问题是。
可是,即使是这样,生活的意义的出现仍然代表了一定的意义。所谓生活的意义,关键是生活的意义需要如何写。非洲曾经说过,最灵繁的人也看不见自己的背脊。这启发了我,生活中,若生活的意义出现了,我们就不得不考虑它出现了的事实。我们不得不面对一个非常尴尬的事实,那就是,裴斯泰洛齐曾经说过,今天应做的事没有做,明天再早也是耽误了。这不禁令我深思。生活的意义,发生了会如何,不发生又会如何。这样看来,从这个角度来看,那么,带着这些问题,我们来审视一下生活的意义。

They are all multibyte characters(except eol). The original display result is
image

And when I use s, the result is like below:
image

Some characters become encode number(?) like becomes <93>. The later ones occupy 4 grid. I believe they are direct match labels. Is there any rendering bug?

Besides, when I enter after s shortcut, the result is
image

The display lines seems weird.

  • The f label on the first display line seems to be misaligned, which should be after char.
  • The next to last char on the second display line does not show up. Maybe a render bug?
  • etc

Is multibyte chars not taken into consideration during rendering?
Besides, with multibyte chars, position calculation may be more complicated I think.

Updated:

Environments
  • nvim verison:
NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
  • OS: get the same problem on Mac OS and Arch Linux
Minimal configurations
@ggandor ggandor added the bug Something isn't working label Mar 17, 2022
@ggandor
Copy link
Owner

ggandor commented Mar 25, 2022

Interestingly, I cannot reproduce the first example (the unique chars are highlighted normally for me in Lightspeed). Try these with Leap, because there I fixed a bug related to multibyte characters, if that works, I'll just apply the same fix here. I can reproduce the alignment issue (in Leap it works as it should).

@gkzhb
Copy link
Author

gkzhb commented May 22, 2022

I tried leap.nvim and get the same problem for s keymapping (cursor at the begining of the document):

image

Below is how lightspeed.nvim behaves.

image

It seems the bug exists in both plugins.

Results above can be reproduced with these minimal lua configs:

PS: Line 3 packer_is_optional variable in these configs may be updated according to the installation path of local packer.nvim

The example text file can be found here

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

No branches or pull requests

2 participants