-
I'm using xterm.js to output a build log and I would like the output canvas to just keep growing together with the output instead of scrolling off. I've tried automatically resizing the terminal onData but found that a) I couldn't reliably make it the right size and b) the whole thing was incredibly laggy. I'm thinking there should be an easier way to just let the viewport grow with the scroll-area, or replace the former with the latter completely. Is there a straight-forward way to do that? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Short answer - nope. The size concept is so crucial & deeply woven into terminals, that you always would have to go with Idk what your exact use case looks like, but what shall happen for 10000+ lines of output? Browser OOM due to an overly big canvas in height? |
Beta Was this translation helpful? Give feedback.
-
Thanks for taking the time to reply and for your assessment. |
Beta Was this translation helpful? Give feedback.
Short answer - nope. The size concept is so crucial & deeply woven into terminals, that you always would have to go with
term.resize
, which itself triggers alot of follow-up code to do state updates and inform the backend about the resize. This is always cumbersome and costly. It is also the reason why it should not occur over and over, it is meant to be exceptional from user interaction. To still do it automatically from incoming data, maybe see https://stackoverflow.com/a/73005790/12548337.Idk what your exact use case looks like, but what shall happen for 10000+ lines of output? Browser OOM due to an overly big canvas in height?