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

Add setting for fontSize and lineHeight to the integrated terminal #6998

Merged
merged 1 commit into from
Jun 3, 2016

Conversation

kisstkondoros
Copy link
Contributor

resolves #6728

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @Tyriar to be a potential reviewer

@msftclas
Copy link

Hi @kisstkondoros, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

'type': 'string',
'default': ''
},
'terminal.integrated.charWidth': {
Copy link
Member

@Tyriar Tyriar May 28, 2016

Choose a reason for hiding this comment

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

I think #6456 should be figured out before the font size and line height is added to prevent addition the charWidth/charHeight settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also thought about that, but I have no clean solution in mind...
Perhaps measuring a character like X or M with canvas api... smth. like https://msdn.microsoft.com/en-us/library/ff975421(v=vs.85).aspx

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that's why I haven't tackled it yet 😉

Something along the lines of that is what I was thinking, I think you might be able to do it by creating a div and measuring that.

@Tyriar Tyriar added the terminal General terminal issues that don't fall under another label label May 28, 2016
@Tyriar Tyriar self-assigned this May 28, 2016
@kisstkondoros
Copy link
Contributor Author

@Tyriar The mentioned measurement method seems to work quite well, of course after 3fde039 it will need some adjustments.

@Tyriar
Copy link
Member

Tyriar commented May 29, 2016

@kisstkondoros Awesome! 👍

@Tyriar
Copy link
Member

Tyriar commented May 31, 2016

@kisstkondoros I merged the PR into master as the 1.2 release was branched off.

@Tyriar
Copy link
Member

Tyriar commented May 31, 2016

I moved the configuration code into terminalConfigHelper.ts to make it more testable, 775c643

Maybe changing getFontFamily into getFont which returns an ITerminalFont would be best since all 3 values are used together:

export interface ITerminalFont {
    fontFamily: string;
    fontSize: string;
    lineHeight: string;
}

@kisstkondoros kisstkondoros force-pushed the terminalfont branch 2 times, most recently from a7be30e to 62b0bb1 Compare June 2, 2016 05:13
@kisstkondoros
Copy link
Contributor Author

@Tyriar Please have a look, I hope that was the idea! 😉

@@ -41,6 +41,14 @@ configurationRegistry.registerConfiguration({
'terminal.integrated.fontFamily': {
'description': nls.localize('terminal.integrated.fontFamily', "The font family used by the terminal (CSS font-family format), this defaults to editor.fontFamily's value."),
'type': 'string'
},
'terminal.integrated.fontSize': {
'description': nls.localize('terminal.integrated.fontSize', "The font size used by the terminal."),
Copy link
Member

Choose a reason for hiding this comment

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

Add: " (in pixels)"

@Tyriar
Copy link
Member

Tyriar commented Jun 2, 2016

@kisstkondoros really nice work! Made a bunch of comments, mainly just names and shuffling things around.

@Tyriar Tyriar added this to the June 2016 milestone Jun 2, 2016
@kisstkondoros
Copy link
Contributor Author

@Tyriar based on Your comments I've did a refactor, some stuff has been simplified a lot.

Things to note:

  • Updating the font doesn't triggers layout, I had to add it manually
  • BoundingClientRect can be 0x0 if the container is not visible
    -- if charWidth and / or charHeight is 0 the terminal resize would crash VSCode, so I've added a guard into the layout method

this.charMeasureElement = new Builder(this.parentDomElement, true).div().build().getHTMLElement();
}
let style = this.charMeasureElement.style;
style.display = 'inline';
Copy link
Member

Choose a reason for hiding this comment

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

Will this flicker the element on the screen? Should it be positioned absolutely off screen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll check, but this triggers a synchronous layout and then immediatelly removes it I think it is not visible.

@Tyriar
Copy link
Member

Tyriar commented Jun 2, 2016

Really nice! Just a couple of little things and good to go, I'm also cloning your branch to check it out.

@@ -41,6 +41,14 @@ configurationRegistry.registerConfiguration({
'terminal.integrated.fontFamily': {
'description': nls.localize('terminal.integrated.fontFamily', "The font family used by the terminal (CSS font-family format), this defaults to editor.fontFamily's value."),
'type': 'string'
},
'terminal.integrated.fontSize': {
Copy link
Member

Choose a reason for hiding this comment

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

Font size should have a default here, otherwise auto-complete does this.

image

@kisstkondoros
Copy link
Contributor Author

I'll continue with it tomorrow.
Thanks for the feedback! 👍

@@ -41,6 +41,14 @@ configurationRegistry.registerConfiguration({
'terminal.integrated.fontFamily': {
'description': nls.localize('terminal.integrated.fontFamily', "The font family used by the terminal (CSS font-family format), this defaults to editor.fontFamily's value."),
'type': 'string'
},
'terminal.integrated.fontSize': {
'description': nls.localize('terminal.integrated.fontSize', "The font size used by the terminal (in pixels), this defaults to editor.fontSize's value."),
Copy link
Member

Choose a reason for hiding this comment

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

Sorry but let's go for consistency with the editor settings for this in commonEditorConfig.ts:

"Controls the font family of the terminal."
"Controls the font size of the terminal."
"Controls the line height of the terminal."

@Tyriar Tyriar merged commit 6cbd485 into microsoft:master Jun 3, 2016
@Tyriar
Copy link
Member

Tyriar commented Jun 3, 2016

Thanks a lot @kisstkondoros, this is awesome! I'm going to refactor terminalPanel.ts for #6458 and didn't want to introduce a bunch of conflicts so I'll make the touch ups mentioned. It should land in the June release! 🎆

@kisstkondoros
Copy link
Contributor Author

Awesome, thanks! 🎉

@kisstkondoros kisstkondoros deleted the terminalfont branch June 3, 2016 04:27
@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
terminal General terminal issues that don't fall under another label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add setting for fontSize and lineHeight to the integrated terminal
4 participants