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

font size improvements #57

Merged
merged 5 commits into from Jul 6, 2016
Merged

font size improvements #57

merged 5 commits into from Jul 6, 2016

Conversation

nfcampos
Copy link
Contributor

@nfcampos nfcampos commented Jul 5, 2016

closes #44 and #45

  • fixed keyboard shortcut registering (listeners were being called twice)
  • now saving fontSize in the state of Hyperterm
  • Term now accepts fontSize as a prop and internally sets it
  • added font size indicator on change (next to rows x cols)

(bonus improvement: now font size is shared between all tabs)

- fixed keyboard shortcut registering (listeners were being called twice)
- now saving fontSize in the state of Hyperterm
- Term now accepts fontSize as a prop and internally sets it
- added font size indicator on change (next to rows x cols)
@jhaynie
Copy link
Contributor

jhaynie commented Jul 5, 2016

nice, great refactor!

@@ -89,7 +91,8 @@ export default class HyperTerm extends Component {
}</div>
</div>
<div className={classes('resize-indicator', { showing: this.state.resizeIndicatorShowing })}>
{ this.state.cols }x{ this.state.rows }
<div>{ this.state.fontSize }px</div>
Copy link
Member

Choose a reason for hiding this comment

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

does this mean we always show the font size when resizing? perhaps a bit too much info?

Copy link
Member

Choose a reason for hiding this comment

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

ideally, we only show the font size change when the font size changes, and the cols and rows when the cols and rows change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep makes sense, i've made it like you said

keys.bind('command+=', this.increaseFontSize);
keys.bind('command+-', this.decreaseFontSize);
keys.bind('command+plus', this.increaseFontSize);
keys.bind('command+minus', this.decreaseFontSize);
Copy link
Member

Choose a reason for hiding this comment

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

is this still needed since we now use the electron accelerators in index.js ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're quite right (this is probably why the listener was being called twice) fixed

@rauchg
Copy link
Member

rauchg commented Jul 5, 2016

Super clean stuff @nfcampos

}

increaseFontSize () {
this.changeFontSize(1);
this.changeFontSize(1, true);
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'm not the biggest fan of boolean arguments but I didn't want to repeat that setTimeout thing in two functions...
I can change it to this.changeFontSize(1, {increment: true}), should I?

Copy link
Member

Choose a reason for hiding this comment

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

{ relative: true } ?
Also, are we cleaning up fontSizeIndicatorTimeout on unmount?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah relative is better.
good catch, I'd forgotten about that
I've made both changes

@rauchg rauchg merged commit ea8ca82 into vercel:master Jul 6, 2016
@rauchg
Copy link
Member

rauchg commented Jul 6, 2016

Amazing work @nfcampos

@nfcampos nfcampos deleted the font-size branch July 6, 2016 01:01
@jdsimcoe
Copy link

jdsimcoe commented Jul 6, 2016

Does this include changing the types of fonts @rauchg?

@rauchg
Copy link
Member

rauchg commented Jul 6, 2016

We're doing that through config, see the other PR.

@jdsimcoe
Copy link

jdsimcoe commented Jul 6, 2016

What PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants