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

Characters are removed from the end of lines when cols is reduced #42

Open
Nathan219 opened this issue Aug 20, 2014 · 2 comments
Open

Comments

@Nathan219
Copy link

Whenever the term.resize() is called with a number lower than the length of any line, the characters at the end are just popped off, and cannot be recovered.

Here's the offending line in term.js
// resize cols
j = this.cols;
if (j < x) {
ch = [this.defAttr, ' ']; // does xterm use the default attr?
i = this.lines.length;
while (i--) {
while (this.lines[i].length < x) {
this.lines[i].push(ch);
}
}
} else if (j > x) {
i = this.lines.length;
while (i--) {
while (this.lines[i].length > x) {
this.lines[i].pop();
}
}
}

That last line is just popping off the data! Unless I'm resizing it wrong, how am I supposed to prevent this? My current workaround is to not reduce the col number past 80.

@luisbravoa
Copy link

I am getting the same issue, any news on this?

Thanks!

@amshali
Copy link
Contributor

amshali commented May 5, 2015

I am pretty sure the issue is something else. How are you doing the resize? Just on the client side with term.resize()? If so that is definitely the issue. You also need to resize on the server side, otherwise your pty won't be in sync with your web term instance. Try this:
Client side:

socket.emit('resize', newSize);
term.resize(newSize.cols, newSize.rows);

On the server side:

socket.on('resize', function(options) {
term.resize(options.cols, options.rows);
});

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

No branches or pull requests

3 participants