Change the value of cols as 81 or greater var term = new Terminal({cols:81}); or use term.fit();


Not sure I understand the problem. The output and wrapping looks fine because the terminal width is 81?
The picture is displayed a little small to see it correctly, the prompt is overwritten (at the red circle), so root@localhost became ssst@localhost - so the breaking sss characters, that should have gone to a new line where overwriting the prompt in the original line.
I can't reproduce this in the xterm.js demo (with the current master) - or I am missing the steps to reproduce it. Can you make a video (gif) of how you are causing this glitch?
Also are you sure "Any Windows/Linux/Mac" is true? Normally Windows behaves different with things like this.
If you're not using the demo what are you using as the backend?
I have the same quesition too.When I enter the long term,Instead of wrapping,the Terminal enter the command at the beginning of the current line.How can I solve this problem?Thank you for your help!
same quesition found, often happened after I resized the window

This is normally related to the pty size not being synced with xterm.js' size.
I have the same quesition too.How can I solve this problem?Thank you for your help!
I am having this same issue. But contrary to @Tyriar's comment, resize and reflow are occurring based on escape sequences (unless I misunderstood your comment, I'm new to this). And even if the sync was slightly off, putting a very large number of characters onto the line never produces a break. I'm using the fit() plugin. Not sure what else to do to diagnose the issue.
@reedspool Please check that the pty size is equal to xterm.js size at a certain time. If not you prolly dont propagate the resize back to the pty.
If they are equal, well then we need more info - how you set up xterm.js, what chars you have tried (there is small chance that a char in the data has different terminal width in pty vs. xterm.js).
In case this helps anyone that comes across the same problem - I managed to produce this bug when I had accidentally swapped rows and columns somewhere along the way between xterm and pty.
Most helpful comment
This is normally related to the pty size not being synced with xterm.js' size.