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

Check if charMeasure is defined in headless mode #1385

Merged
merged 1 commit into from
Apr 12, 2018

Conversation

johnpoth
Copy link
Contributor

When running Xterm.js in headless mode ( i.e not calling the open(container) function) I get:

TypeError: Cannot read property 'width' of undefined at Terminal.resize (xterm.js:4099)

The fix is similar to what was done here.

Thanks!

Copy link
Contributor

@mofux mofux left a comment

Choose a reason for hiding this comment

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

Thanks for this bug fix. I left a comment, apart from that I'm happy to merge it.

src/Terminal.ts Outdated
if (!this.charMeasure.width || !this.charMeasure.height) {
this.charMeasure.measure(this.options);
if (this.charMeasure) {
if (!this.charMeasure.width || !this.charMeasure.height) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest to combine both if statements into one:

if (this.charMeasure && (!this.charMeasure.width || !this.charMeasure.height)) {
  ...
}

@johnpoth
Copy link
Contributor Author

@mofux updated, thanks for reviewing!

@Tyriar Tyriar added this to the 3.4.0 milestone Apr 12, 2018
@mofux
Copy link
Contributor

mofux commented Apr 12, 2018

@Tyriar Passing merge control over to you 😅

@Tyriar Tyriar merged commit a3cb34f into xtermjs:master Apr 12, 2018
@johnpoth johnpoth deleted the headless-mode branch April 12, 2018 14:44
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

3 participants