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

Better non-ASCII character support in word motions #3612

Closed
ajalab opened this issue Mar 22, 2019 · 0 comments · Fixed by #3614
Closed

Better non-ASCII character support in word motions #3612

ajalab opened this issue Mar 22, 2019 · 0 comments · Fixed by #3614

Comments

@ajalab
Copy link
Contributor

ajalab commented Mar 22, 2019

Is your feature request related to a problem? Please describe.
This feature request includes a fix of #3439, which specifically mentioned Chinese characters.

Describe the solution you'd like
Word motions (w, b, ...) move a cursor too far away on non-ASCII characters (e.g., CJK ideographs). This issue doesn't occur in the original Vim.
Vim regards a word as a sequence of characters which have the same class (cf. fwd_word in src/search.c). In UTF-8 encoding, the function cls (in src/search.c) returns the class which distinguishes the different kinds of symbols (punctuations, ideographs, emoji, ...) according to the table in src/mbyte.c.
It would be great if VSCodeVim follows this behavior. I've made a prototype implementation for this change that modifies makeWordRegex in src/common/motion/position.ts to support non-ASCII characters.

Describe alternatives you've considered
For Japanese, an ad-hoc fix has been proposed in https://qiita.com/jagijagijag1/items/4badc62d2627705a3eb0, which appends several punctuations, parentheses, and Japanese post-positional particles to editor.wordSeparators.
This reduces the problem but is not a perfect solution, because it causes another problem that cursors sometimes stop in the middle of words.

Additional context
Screen captures of results of word motions (w and b)

VSCodeVim
vscode-vim

Vim (preferred)
vim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants