xtermjs / xterm.js

A terminal for the web
https://xtermjs.org/
MIT License
17.61k stars 1.63k forks source link

onScroll event does not get fired on user scroll #3864

Open AndreSilva1993 opened 2 years ago

AndreSilva1993 commented 2 years ago

The documentation states that onScroll gets fired when the viewport's scroll position changes which is not true. This event is only fired when new lines are introduced.

TheBlindM commented 1 year ago

Is it fixed?

jerch commented 1 year ago

I think there is still that misconception at work here - onScroll was initially meant to indicate line scrolling in the terminal buffer, thus when the cursor addressable area gets moved. This is only partially linked to viewport scrolling in the case, that both happen together. Isolated viewport scrolling without any change on the terminal buffer is not handled by that.

I am not sure if we should fuse buffer scrolling and viewport scrolling any further into one event, they are really 2 different things for the terminal. From a technical viewpoint a separate onViewportScroll event makes more sense, which we dont have atm. @Tyriar Imho we already had several issues for that, but cant find them atm.

tabarra commented 9 months ago

Just to confirm this is still an issue in v5.4.0-beta.20.

I'll also just add a reference to the origin of this issue, where @Tyriar asked for a new thread to be made: https://github.com/xtermjs/xterm.js/pull/3205#issuecomment-1157774699

McDaddy commented 8 months ago

Any update for this issue? My case is scroll top to load more data, I think it's a very command case. Do we have any workaround for this?

tabarra commented 8 months ago

@McDaddy Here is my workaround:
https://github.com/tabarra/txAdmin/blob/v7.0.0/panel/src/pages/LiveConsole/ScrollDownAddon.ts