-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
adjust width for CJK characters #15838
Conversation
@rebornix, thanks for your PR! By analyzing the history of the files in this pull request, we identified @egamma, @alexandrudima and @jrieken to be potential reviewers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok, but the new code should run only if the cursor is configured to be rendered as a block. Currently, this makes line cursors (the default we ship with) render as a block cursor
@@ -128,6 +129,17 @@ export class ViewCursor { | |||
this._positionTop = visibleRange.top; | |||
this._positionLeft = visibleRange.left; | |||
this._isInViewport = true; | |||
|
|||
let visibleRangeForCharacter = ctx.linesVisibleRangesForRange({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rebornix This extra call should be done only if the cursor style is a block cursor
@@ -156,6 +168,15 @@ export class ViewCursor { | |||
this._domNode.setLineHeight(this._lineHeight); | |||
this._domNode.setHeight(this._lineHeight); | |||
|
|||
let desiredWidth = '1ch'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rebornix Computing the desiredWidth and setting it needs to happen only if the cursor style is set to block.
Comments addressed. Only update cursor width if its style is block or underline. @alexandrudima we had issues with underline cursor style as well, which should be taken care of the same way as block cursor. Besides, this fix makes tab more explicit as below |
👍 |
Fix #11859 . Read character from view to get the correct width of a character.