Skip to content

Commit

Permalink
Merge pull request #44259 from yh1224/fulllwidth
Browse files Browse the repository at this point in the history
Treat full-width character as two visible columns.
  • Loading branch information
alexdima committed Mar 1, 2018
2 parents 0af74d6 + ba7354f commit bae62c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/vs/editor/common/controller/cursorCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit bae62c1

Please sign in to comment.