TypeError calling resize() via fit add-on
See original GitHub issueI’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:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I should stop commenting after midnight 😢.
@parisk
buffer.lines
is coming in 2.9.0