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

adjust width for CJK characters #15838

Merged
merged 2 commits into from
Nov 29, 2016
Merged

Conversation

rebornix
Copy link
Member

Fix #11859 . Read character from view to get the correct width of a character.

@mention-bot
Copy link

@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.

Copy link
Member

@alexdima alexdima left a 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({
Copy link
Member

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';
Copy link
Member

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.

@rebornix
Copy link
Member Author

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

screen shot 2016-11-27 at 1 56 01 pm

screen shot 2016-11-27 at 1 56 15 pm

@alexdima alexdima added this to the November 2016 milestone Nov 29, 2016
@alexdima
Copy link
Member

👍

@alexdima alexdima merged commit 1dbc2f8 into microsoft:master Nov 29, 2016
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Block cursor width is not correct with CJK characters
4 participants