question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError calling resize() via fit add-on

See original GitHub issue

I’m not sure how I’m getting into this state as the application is pretty complex but I have a situation where, on resizing the terminal element, in the resize() code that pads out each line in the terminal I’m ending up with lines that are undefined. This causes the code to fail when it queries for the line length:

TypeError: Cannot read property 'length' of undefined 
message:"Cannot read property 'length' of undefined"
stack:"TypeError: Cannot read property 'length' of undefined\n    at Terminal.19.Terminal.resize (http://localhost:3000/utc/bower_components/xterm.js/dist/xterm.js:4637:37)\n    at Object.exports.fit (http://localhost:3000/utc/bower_components/xterm.js/dist/addons/fit/fit.js:73:12)\n    at Terminal.Xterm.fit (http://localhost:3000/utc/bower_components/xterm.js/dist/addons/fit/fit.js:82:20)\n    at http://localhost:3000/utc/scripts/utccomponents/utcterminal.js:31:19\n    at m.$emit (http://localhost:3000/utc/bower_components/angular/angular.min.js:151:429)\n    at broadcastLeftRightResize (http://localhost:3000/utc/scripts/framework/stratosresizer/resizer.js:96:28)\n    at HTMLDocument.handleMouseUp (http://localhost:3000/utc/scripts/framework/stratosresizer/resizer.js:133:25)"

I’m using an event from the Angular resizer to call fit() but this is not called continuously while the dragging is happening, only once when the resizing is completed.

I can ‘fix’ it by updating the resize method in xterm.js like this:

        ch = [this.defAttr, ' ', 1];
        i = this.lines.length;
        while (i--) {
            ////////////////////////////////////////
            if (this.lines.get(i) === undefined) {
                this.lines.set(i, this.blankLine());
            }
            ////////////////////////////////////////
            while (this.lines.get(i).length < x) {
                this.lines.get(i).push(ch);
            }
        }

But my concern is that, if no-one else is having this problem, it may be an indication of a bigger issue somewhere else.

  • Have you seen anything like this before and if so do you have any idea of what might cause it to happen?
  • Is this a reasonable way to fix it without causing more problems downstream?

Details

  • Browser and browser version: Chrome 59.0.3071.115 (Official Build) (64-bit)
  • OS version: Windows 7
  • xterm.js version: 2.8.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pariskcommented, Jul 28, 2017

I should stop commenting after midnight 😢.

1reaction
Tyriarcommented, Jul 27, 2017

@parisk buffer.lines is coming in 2.9.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

xterm-for-react with xterm-addon-fit throws unable to read ...
I am using xterm-for-react for terminal integration and I want to resize that terminal window as my wrapper div tag around the component ......
Read more >
iframe-resizer
This library enables the automatic resizing of the height and width of both same and cross domain iFrames to fit the contained content....
Read more >
Release Notes for Ext JS 5.1.4
EXTJS-21502 Resizing is broken if component is draggable with translated events ... Proxy does not call base destroy(); EXTJS-20880 Ext.data.reader.
Read more >
ImageResizer - AnkiWeb
Introduction ImageResizer is a simple Anki add-on used to resize images. ... TypeError: _processMime_around() got multiple values for argument '_old'
Read more >
Common Flutter errors
To fix this error, specify how tall the ListView should be. To make it as tall as the remaining space in the Column...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found