Merge pull request #44259 from yh1224/fulllwidth

Treat full-width character as two visible columns.
This commit is contained in:
Alexandru Dima 2018-03-01 12:00:45 +01:00 committed by GitHub
commit bae62c11c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -454,6 +454,8 @@ export class CursorColumns {
let charCode = lineContent.charCodeAt(i);
if (charCode === CharCode.Tab) {
result = this.nextTabStop(result, tabSize);
} else if (strings.isFullWidthCharacter(charCode)) {
result = result + 2;
} else {
result = result + 1;
}
@ -479,6 +481,8 @@ export class CursorColumns {
let afterVisibleColumn: number;
if (charCode === CharCode.Tab) {
afterVisibleColumn = this.nextTabStop(beforeVisibleColumn, tabSize);
} else if (strings.isFullWidthCharacter(charCode)) {
afterVisibleColumn = beforeVisibleColumn + 2;
} else {
afterVisibleColumn = beforeVisibleColumn + 1;
}