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 word motions for non-ASCII characters #3614

Merged
merged 10 commits into from
Apr 2, 2019

Conversation

ajalab
Copy link
Contributor

@ajalab ajalab commented Mar 22, 2019

What this PR does / why we need it:
This PR provides a better support for word motions (w, b, ...) on non-ASCII characters (#3612).
The updated word motions act similarly to those in the original Vim, which distinguishes the different kinds of symbols such as ideographs, punctuations, and hiraganas, so that sequences of such symbols are treated as separate words. Therefore, cursors on Chinese or Japanese sentences do not jump too far away any more.

vscode-updated

Which issue(s) this PR fixes
fixes #3612, fixes #3439.

Special notes for your reviewer:

@jpoon
Copy link
Member

jpoon commented Mar 28, 2019

🎉 Thanks for your PR. Can you add tests?

@ajalab
Copy link
Contributor Author

ajalab commented Mar 29, 2019

Thanks for taking the time to review this PR! I added a new test suite in motion.test.ts.

@@ -108,7 +108,7 @@ export class Position extends vscode.Position {
constructor(line: number, character: number) {
super(line, character);

this._nonWordCharRegex = this.makeWordRegex(Position.NonWordCharacters);
this._nonWordCharRegex = this.makeUnicodeWordRegex(Position.NonWordCharacters);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to address this on this particular PR, but we should move this initialization elsewhere such that is it statically constructed rather than having to create it over and over again...

@jpoon jpoon merged commit 0d02851 into VSCodeVim:master Apr 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants